Java Code Examples for sun.awt.OSInfo#OSType
The following examples show how to use
sun.awt.OSInfo#OSType .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIManager.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 2
Source File: UIManager.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 3
Source File: UIManager.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 4
Source File: UIManager.java From Java8CN with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 5
Source File: UIManager.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 6
Source File: UIManager.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 7
Source File: UIManager.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * 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 { Toolkit toolkit = Toolkit.getDefaultToolkit(); if (toolkit instanceof SunToolkit) { SunToolkit suntk = (SunToolkit)toolkit; String desktop = suntk.getDesktop(); boolean gtkAvailable = suntk.isNativeGTKAvailable(); if ("gnome".equals(desktop) && gtkAvailable) { 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(); }
Example 8
Source File: UIManager.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 9
Source File: UIManager.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 10
Source File: UIManager.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 11
Source File: UIManager.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 12
Source File: UIManager.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 13
Source File: UIManager.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example 14
Source File: MultiScreenInsetsTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws InterruptedException { OSInfo.OSType type = OSInfo.getOSType(); if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) { System.out.println("This test is for Solaris and Linux only..." + "skipping!"); return; } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (gds.length < 2) { System.out.println("It's a multi-screen test... skipping!"); return; } for (int screen = 0; screen < gds.length; ++screen) { GraphicsDevice gd = gds[screen]; GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Frame frame = new Frame(gc); frame.setLocation(bounds.x + (bounds.width - SIZE) / 2, bounds.y + (bounds.height - SIZE) / 2); frame.setSize(SIZE, SIZE); frame.setUndecorated(true); frame.setVisible(true); // Maximize Frame to reach the struts frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); Thread.sleep(2000); Rectangle frameBounds = frame.getBounds(); frame.dispose(); if (bounds.x + insets.left != frameBounds.x || bounds.y + insets.top != frameBounds.y || bounds.width - insets.right - insets.left != frameBounds.width || bounds.height - insets.bottom - insets.top != frameBounds.height) { throw new RuntimeException("Test FAILED! Wrong screen #" + screen + " insets: " + insets); } } System.out.println("Test PASSED!"); }
Example 15
Source File: MultiScreenInsetsTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws InterruptedException { OSInfo.OSType type = OSInfo.getOSType(); if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) { System.out.println("This test is for Solaris and Linux only..." + "skipping!"); return; } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (gds.length < 2) { System.out.println("It's a multi-screen test... skipping!"); return; } for (int screen = 0; screen < gds.length; ++screen) { GraphicsDevice gd = gds[screen]; GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Frame frame = new Frame(gc); frame.setLocation(bounds.x + (bounds.width - SIZE) / 2, bounds.y + (bounds.height - SIZE) / 2); frame.setSize(SIZE, SIZE); frame.setUndecorated(true); frame.setVisible(true); // Maximize Frame to reach the struts frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); Thread.sleep(2000); Rectangle frameBounds = frame.getBounds(); frame.dispose(); if (bounds.x + insets.left != frameBounds.x || bounds.y + insets.top != frameBounds.y || bounds.width - insets.right - insets.left != frameBounds.width || bounds.height - insets.bottom - insets.top != frameBounds.height) { throw new RuntimeException("Test FAILED! Wrong screen #" + screen + " insets: " + insets); } } System.out.println("Test PASSED!"); }
Example 16
Source File: MultiScreenInsetsTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws InterruptedException { OSInfo.OSType type = OSInfo.getOSType(); if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) { System.out.println("This test is for Solaris and Linux only..." + "skipping!"); return; } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (gds.length < 2) { System.out.println("It's a multi-screen test... skipping!"); return; } for (int screen = 0; screen < gds.length; ++screen) { GraphicsDevice gd = gds[screen]; GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Frame frame = new Frame(gc); frame.setLocation(bounds.x + (bounds.width - SIZE) / 2, bounds.y + (bounds.height - SIZE) / 2); frame.setSize(SIZE, SIZE); frame.setUndecorated(true); frame.setVisible(true); // Maximize Frame to reach the struts frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); Thread.sleep(2000); Rectangle frameBounds = frame.getBounds(); frame.dispose(); if (bounds.x + insets.left != frameBounds.x || bounds.y + insets.top != frameBounds.y || bounds.width - insets.right - insets.left != frameBounds.width || bounds.height - insets.bottom - insets.top != frameBounds.height) { throw new RuntimeException("Test FAILED! Wrong screen #" + screen + " insets: " + insets); } } System.out.println("Test PASSED!"); }
Example 17
Source File: MultiScreenInsetsTest.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws InterruptedException { OSInfo.OSType type = OSInfo.getOSType(); if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) { System.out.println("This test is for Solaris and Linux only..." + "skipping!"); return; } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (gds.length < 2) { System.out.println("It's a multi-screen test... skipping!"); return; } for (int screen = 0; screen < gds.length; ++screen) { GraphicsDevice gd = gds[screen]; GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Frame frame = new Frame(gc); frame.setLocation(bounds.x + (bounds.width - SIZE) / 2, bounds.y + (bounds.height - SIZE) / 2); frame.setSize(SIZE, SIZE); frame.setUndecorated(true); frame.setVisible(true); // Maximize Frame to reach the struts frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); Thread.sleep(2000); Rectangle frameBounds = frame.getBounds(); frame.dispose(); if (bounds.x + insets.left != frameBounds.x || bounds.y + insets.top != frameBounds.y || bounds.width - insets.right - insets.left != frameBounds.width || bounds.height - insets.bottom - insets.top != frameBounds.height) { throw new RuntimeException("Test FAILED! Wrong screen #" + screen + " insets: " + insets); } } System.out.println("Test PASSED!"); }
Example 18
Source File: MultiScreenInsetsTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws InterruptedException { OSInfo.OSType type = OSInfo.getOSType(); if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) { System.out.println("This test is for Solaris and Linux only..." + "skipping!"); return; } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (gds.length < 2) { System.out.println("It's a multi-screen test... skipping!"); return; } for (int screen = 0; screen < gds.length; ++screen) { GraphicsDevice gd = gds[screen]; GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Frame frame = new Frame(gc); frame.setLocation(bounds.x + (bounds.width - SIZE) / 2, bounds.y + (bounds.height - SIZE) / 2); frame.setSize(SIZE, SIZE); frame.setUndecorated(true); frame.setVisible(true); // Maximize Frame to reach the struts frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); Thread.sleep(2000); Rectangle frameBounds = frame.getBounds(); frame.dispose(); if (bounds.x + insets.left != frameBounds.x || bounds.y + insets.top != frameBounds.y || bounds.width - insets.right - insets.left != frameBounds.width || bounds.height - insets.bottom - insets.top != frameBounds.height) { throw new RuntimeException("Test FAILED! Wrong screen #" + screen + " insets: " + insets); } } System.out.println("Test PASSED!"); }
Example 19
Source File: MultiScreenInsetsTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws InterruptedException { OSInfo.OSType type = OSInfo.getOSType(); if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) { System.out.println("This test is for Solaris and Linux only..." + "skipping!"); return; } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (gds.length < 2) { System.out.println("It's a multi-screen test... skipping!"); return; } for (int screen = 0; screen < gds.length; ++screen) { GraphicsDevice gd = gds[screen]; GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Frame frame = new Frame(gc); frame.setLocation(bounds.x + (bounds.width - SIZE) / 2, bounds.y + (bounds.height - SIZE) / 2); frame.setSize(SIZE, SIZE); frame.setUndecorated(true); frame.setVisible(true); // Maximize Frame to reach the struts frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); Thread.sleep(2000); Rectangle frameBounds = frame.getBounds(); frame.dispose(); if (bounds.x + insets.left != frameBounds.x || bounds.y + insets.top != frameBounds.y || bounds.width - insets.right - insets.left != frameBounds.width || bounds.height - insets.bottom - insets.top != frameBounds.height) { throw new RuntimeException("Test FAILED! Wrong screen #" + screen + " insets: " + insets); } } System.out.println("Test PASSED!"); }
Example 20
Source File: MultiScreenInsetsTest.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws InterruptedException { OSInfo.OSType type = OSInfo.getOSType(); if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) { System.out.println("This test is for Solaris and Linux only..." + "skipping!"); return; } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); if (gds.length < 2) { System.out.println("It's a multi-screen test... skipping!"); return; } for (int screen = 0; screen < gds.length; ++screen) { GraphicsDevice gd = gds[screen]; GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Frame frame = new Frame(gc); frame.setLocation(bounds.x + (bounds.width - SIZE) / 2, bounds.y + (bounds.height - SIZE) / 2); frame.setSize(SIZE, SIZE); frame.setUndecorated(true); frame.setVisible(true); // Maximize Frame to reach the struts frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); Thread.sleep(2000); Rectangle frameBounds = frame.getBounds(); frame.dispose(); if (bounds.x + insets.left != frameBounds.x || bounds.y + insets.top != frameBounds.y || bounds.width - insets.right - insets.left != frameBounds.width || bounds.height - insets.bottom - insets.top != frameBounds.height) { throw new RuntimeException("Test FAILED! Wrong screen #" + screen + " insets: " + insets); } } System.out.println("Test PASSED!"); }