Search in sources :

Example 26 with GetPropertyAction

use of sun.security.action.GetPropertyAction in project jdk8u_jdk by JetBrains.

the class UIManager method getSystemLookAndFeelClassName.

/**
     * Returns the name of the <code>LookAndFeel</code> class that implements
     * the native system look and feel if there is one, otherwise
     * the name of the default cross platform <code>LookAndFeel</code>
     * class. This value can be overriden by setting the
     * <code>swing.systemlaf</code> system property.
     *
     * @return the <code>String</code> of the <code>LookAndFeel</code>
     *          class
     *
     * @see #setLookAndFeel
     * @see #getCrossPlatformLookAndFeelClassName
     */
public static String getSystemLookAndFeelClassName() {
    String systemLAF = AccessController.doPrivileged(new GetPropertyAction("swing.systemlaf"));
    if (systemLAF != null) {
        return systemLAF;
    }
    OSInfo.OSType osType = AccessController.doPrivileged(OSInfo.getOSTypeAction());
    if (osType == OSInfo.OSType.WINDOWS) {
        return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    } else {
        String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        if ("gnome".equals(desktop) && toolkit instanceof SunToolkit && ((SunToolkit) toolkit).isNativeGTKAvailable()) {
            // May be set on Linux and Solaris boxs.
            return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
        }
        if (osType == OSInfo.OSType.MACOSX) {
            if (toolkit.getClass().getName().equals("sun.lwawt.macosx.LWCToolkit")) {
                return "com.apple.laf.AquaLookAndFeel";
            }
        }
        if (osType == OSInfo.OSType.SOLARIS) {
            return "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
        }
    }
    return getCrossPlatformLookAndFeelClassName();
}
Also used : OSInfo(sun.awt.OSInfo) GetPropertyAction(sun.security.action.GetPropertyAction) SunToolkit(sun.awt.SunToolkit) SunToolkit(sun.awt.SunToolkit) Toolkit(java.awt.Toolkit)

Aggregations

GetPropertyAction (sun.security.action.GetPropertyAction)26 IOException (java.io.IOException)2 PrintStream (java.io.PrintStream)2 BorderLayout (java.awt.BorderLayout)1 Component (java.awt.Component)1 Graphics (java.awt.Graphics)1 Rectangle (java.awt.Rectangle)1 Toolkit (java.awt.Toolkit)1 CMMException (java.awt.color.CMMException)1 ContainerEvent (java.awt.event.ContainerEvent)1 ContainerListener (java.awt.event.ContainerListener)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 InetSocketAddress (java.net.InetSocketAddress)1 Proxy (java.net.Proxy)1 ProxySelector (java.net.ProxySelector)1 ServerSocket (java.net.ServerSocket)1 SocketException (java.net.SocketException)1 URI (java.net.URI)1