01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
10: http://www.apache.org/licenses/LICENSE-2.0
11:
12: Unless required by applicable law or agreed to in writing, software
13: distributed under the License is distributed on an "AS IS" BASIS,
14: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: See the License for the specific language governing permissions and
16: limitations under the License.
17:
18: */
19: package org.apache.batik.util;
20:
21: import java.awt.Frame;
22: import java.lang.reflect.Method;
23:
24: /**
25: * Platform specific functionality.
26: *
27: * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
28: * @version $Id$
29: */
30: public abstract class Platform {
31:
32: /**
33: * Whether we are running on Mac OS X.
34: */
35: public static boolean isOSX = System.getProperty("os.name").equals(
36: "Mac OS X");
37:
38: /**
39: * Whether we are running on JRE 1.3.
40: */
41: public static boolean isJRE13 = System.getProperty("java.version")
42: .startsWith("1.3");
43:
44: /**
45: * Unmaximizes the specified Frame.
46: */
47: public static void unmaximize(Frame f) {
48: if (!isJRE13) {
49: try {
50: Method m1 = Frame.class.getMethod("getExtendedState",
51: (Class[]) null);
52: Method m2 = Frame.class.getMethod("setExtendedState",
53: new Class[] { Integer.TYPE });
54: int i = ((Integer) m1.invoke(f, (Object[]) null))
55: .intValue();
56: m2.invoke(f, new Object[] { new Integer(i & ~6) });
57: } catch (java.lang.reflect.InvocationTargetException ite) {
58: } catch (NoSuchMethodException nsme) {
59: } catch (IllegalAccessException iae) {
60: }
61: }
62: }
63: }
|