Platform specific functionality. : OS « Development Class « Java






Platform specific functionality.

      


import java.awt.Frame;
import java.lang.reflect.Method;

/**
 * Platform specific functionality.
 *
 * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
 * @version $Id: Platform.java 582434 2007-10-06 02:11:51Z cam $
 */
public abstract class Platform {

    /**
     * Whether we are running on Mac OS X.
     */
    public static boolean isOSX =
        System.getProperty("os.name").equals("Mac OS X");

    /**
     * Whether we are running on JRE 1.3.
     */
    public static boolean isJRE13 =
        System.getProperty("java.version").startsWith("1.3");

    /**
     * Unmaximizes the specified Frame.
     */
    public static void unmaximize(Frame f) {
        if (!isJRE13) {
            try {
                Method m1 =
                    Frame.class.getMethod("getExtendedState", (Class[]) null);
                Method m2 =
                    Frame.class.getMethod("setExtendedState",
                                          new Class[] { Integer.TYPE });
                int i = ((Integer) m1.invoke(f, (Object[]) null)).intValue();
                m2.invoke(f, new Object[] { new Integer(i & ~6) });
            } catch (java.lang.reflect.InvocationTargetException ite) {
            } catch (NoSuchMethodException nsme) {
            } catch (IllegalAccessException iae) {
            }
        }
    }
}

   
    
    
    
    
    
  








Related examples in the same category

1.Class representing a standard operating system platform, WIN, MAC, or POSIX.
2.Get OS
3.Condition that tests the OS type.
4.Class to help determining the OS
5.Splits apart a OS separator delimited set of paths in a string into multiple Strings.
6.Get the operating systemGet the operating system
7.Get the OS
8.Virtual Machine Information (JVM)
9.Java Platform Information
10.Get OS Info
11.Platform Detector
12.OS detector
13.OS name
14.Operating System