Platform specific functionality. : OS « Development Class « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JDK 6
25.JNDI LDAP
26.JPA
27.JSP
28.JSTL
29.Language Basics
30.Network Protocol
31.PDF RTF
32.Reflection
33.Regular Expressions
34.Scripting
35.Security
36.Servlets
37.Spring
38.Swing Components
39.Swing JFC
40.SWT JFace Eclipse
41.Threads
42.Tiny Application
43.Velocity
44.Web Services SOA
45.XML
Java » Development Class » OSScreenshots 
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 = ((Integerm1.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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.