sun.awt.OSInfo Java Examples
The following examples show how to use
sun.awt.OSInfo.
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: WindowsLookAndFeel.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
ActiveWindowsIcon(String desktopPropertyName, String nativeImageName, String fallbackName) { this.nativeImageName = nativeImageName; this.fallbackName = fallbackName; if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS && OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) < 0) { // This desktop property is needed to trigger reloading the icon. // It is kept in member variable to avoid GC. this.desktopProperty = new TriggerDesktopProperty(desktopPropertyName) { @Override protected void updateUI() { icon = null; super.updateUI(); } }; } }
Example #2
Source File: NSTexturedJFrame.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { System.out.println("This test is for OSX, considered passed."); return; } // Default window appearance showFrame(); step++; // apple.awt.brushMetalLook appearance showFrame(); step++; // Window.style appearance showFrame(); // images on step 1 and 2 should be same testImages(images[1], images[2], false); // images on step 1 and 2 should be different from default testImages(images[0], images[1], true); testImages(images[0], images[2], true); }
Example #3
Source File: bug8046391.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { OSType type = OSInfo.getOSType(); if (type != OSType.WINDOWS) { System.out.println("This test is for Windows only... skipping!"); return; } SwingUtilities.invokeAndWait(() -> { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } System.out.println("Creating JFileChooser..."); JFileChooser fileChooser = new JFileChooser(); System.out.println("Test passed: chooser = " + fileChooser); }); // Test fails if creating JFileChooser hangs }
Example #4
Source File: WindowsLookAndFeel.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
ActiveWindowsIcon(String desktopPropertyName, String nativeImageName, String fallbackName) { this.nativeImageName = nativeImageName; this.fallbackName = fallbackName; if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS && OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) < 0) { // This desktop property is needed to trigger reloading the icon. // It is kept in member variable to avoid GC. this.desktopProperty = new TriggerDesktopProperty(desktopPropertyName) { @Override protected void updateUI() { icon = null; super.updateUI(); } }; } }
Example #5
Source File: deadKeyMacOSX.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { return; } toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); Robot robot = new Robot(); robot.setAutoDelay(50); createAndShowGUI(); // Pressed keys: Alt + E + A // Results: ALT + VK_DEAD_ACUTE + a with accute accent robot.keyPress(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_E); robot.keyRelease(KeyEvent.VK_E); robot.keyRelease(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_A); robot.keyRelease(KeyEvent.VK_A); if (state != 3) { throw new RuntimeException("Wrong number of key events."); } }
Example #6
Source File: bug4524490.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); Robot robot = new Robot(); robot.setAutoDelay(50); UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); SwingUtilities.invokeLater(new Runnable() { public void run() { fileChooser = new JFileChooser(); fileChooser.showOpenDialog(null); } }); toolkit.realSync(); if (OSInfo.OSType.MACOSX.equals(OSInfo.getOSType())) { Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_L); } else { Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_L); } checkFocus(); }
Example #7
Source File: WindowsLookAndFeel.java From hottub with GNU General Public License v2.0 | 6 votes |
ActiveWindowsIcon(String desktopPropertyName, String nativeImageName, String fallbackName) { this.nativeImageName = nativeImageName; this.fallbackName = fallbackName; if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS && OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) < 0) { // This desktop property is needed to trigger reloading the icon. // It is kept in member variable to avoid GC. this.desktopProperty = new TriggerDesktopProperty(desktopPropertyName) { @Override protected void updateUI() { icon = null; super.updateUI(); } }; } }
Example #8
Source File: FileDialogForPackages.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void init() { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { Sysout.createDialogWithInstructions(new String[]{ "Press PASS, this test is for MacOS X only."}); return; } System.setProperty("apple.awt.use-file-dialog-packages", "true"); setLayout(new GridLayout(1, 1)); fd = new FileDialog(new Frame(), "Open"); fd.setDirectory(APPLICATIONS_FOLDER); showBtn = new Button("Show File Dialog"); showBtn.addActionListener(this); add(showBtn); String[] instructions = { "1) Click on 'Show File Dialog' button. A file dialog will come up.", "2) Navigate to the Applications folder if not already there", "3) Check that the application bundles can be selected and can not be navigated", "4) If it's true then the test passed, otherwise it failed."}; Sysout.createDialogWithInstructions(instructions); }
Example #9
Source File: FileDialogForPackages.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void init() { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { Sysout.createDialogWithInstructions(new String[]{ "Press PASS, this test is for MacOS X only."}); return; } System.setProperty("apple.awt.use-file-dialog-packages", "true"); setLayout(new GridLayout(1, 1)); fd = new FileDialog(new Frame(), "Open"); fd.setDirectory(APPLICATIONS_FOLDER); showBtn = new Button("Show File Dialog"); showBtn.addActionListener(this); add(showBtn); String[] instructions = { "1) Click on 'Show File Dialog' button. A file dialog will come up.", "2) Navigate to the Applications folder if not already there", "3) Check that the application bundles can be selected and can not be navigated", "4) If it's true then the test passed, otherwise it failed."}; Sysout.createDialogWithInstructions(instructions); }
Example #10
Source File: deadKeyMacOSX.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { return; } toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); Robot robot = new Robot(); robot.setAutoDelay(50); createAndShowGUI(); // Pressed keys: Alt + E + A // Results: ALT + VK_DEAD_ACUTE + a with accute accent robot.keyPress(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_E); robot.keyRelease(KeyEvent.VK_E); robot.keyRelease(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_A); robot.keyRelease(KeyEvent.VK_A); if (state != 3) { throw new RuntimeException("Wrong number of key events."); } }
Example #11
Source File: PopupFactory.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Obtains the appropriate <code>Popup</code> based on * <code>popupType</code>. */ private Popup getPopup(Component owner, Component contents, int ownerX, int ownerY, int popupType) { if (GraphicsEnvironment.isHeadless()) { return getHeadlessPopup(owner, contents, ownerX, ownerY); } switch(popupType) { case LIGHT_WEIGHT_POPUP: return getLightWeightPopup(owner, contents, ownerX, ownerY); case MEDIUM_WEIGHT_POPUP: return getMediumWeightPopup(owner, contents, ownerX, ownerY); case HEAVY_WEIGHT_POPUP: Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY); if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) && (owner != null) && (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) { ((HeavyWeightPopup)popup).setCacheEnabled(false); } return popup; } return null; }
Example #12
Source File: FileDialogForPackages.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public void init() { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { Sysout.createDialogWithInstructions(new String[]{ "Press PASS, this test is for MacOS X only."}); return; } System.setProperty("apple.awt.use-file-dialog-packages", "true"); setLayout(new GridLayout(1, 1)); fd = new FileDialog(new Frame(), "Open"); fd.setDirectory(APPLICATIONS_FOLDER); showBtn = new Button("Show File Dialog"); showBtn.addActionListener(this); add(showBtn); String[] instructions = { "1) Click on 'Show File Dialog' button. A file dialog will come up.", "2) Navigate to the Applications folder if not already there", "3) Check that the application bundles can be selected and can not be navigated", "4) If it's true then the test passed, otherwise it failed."}; Sysout.createDialogWithInstructions(instructions); }
Example #13
Source File: PopupFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Obtains the appropriate <code>Popup</code> based on * <code>popupType</code>. */ private Popup getPopup(Component owner, Component contents, int ownerX, int ownerY, int popupType) { if (GraphicsEnvironment.isHeadless()) { return getHeadlessPopup(owner, contents, ownerX, ownerY); } switch(popupType) { case LIGHT_WEIGHT_POPUP: return getLightWeightPopup(owner, contents, ownerX, ownerY); case MEDIUM_WEIGHT_POPUP: return getMediumWeightPopup(owner, contents, ownerX, ownerY); case HEAVY_WEIGHT_POPUP: Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY); if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) && (owner != null) && (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) { ((HeavyWeightPopup)popup).setCacheEnabled(false); } return popup; } return null; }
Example #14
Source File: bug8046391.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { OSType type = OSInfo.getOSType(); if (type != OSType.WINDOWS) { System.out.println("This test is for Windows only... skipping!"); return; } SwingUtilities.invokeAndWait(() -> { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } System.out.println("Creating JFileChooser..."); JFileChooser fileChooser = new JFileChooser(); System.out.println("Test passed: chooser = " + fileChooser); }); // Test fails if creating JFileChooser hangs }
Example #15
Source File: bug8046391.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { OSType type = OSInfo.getOSType(); if (type != OSType.WINDOWS) { System.out.println("This test is for Windows only... skipping!"); return; } SwingUtilities.invokeAndWait(() -> { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } System.out.println("Creating JFileChooser..."); JFileChooser fileChooser = new JFileChooser(); System.out.println("Test passed: chooser = " + fileChooser); }); // Test fails if creating JFileChooser hangs }
Example #16
Source File: PopupFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Obtains the appropriate <code>Popup</code> based on * <code>popupType</code>. */ @SuppressWarnings("deprecation") private Popup getPopup(Component owner, Component contents, int ownerX, int ownerY, int popupType) { if (GraphicsEnvironment.isHeadless()) { return getHeadlessPopup(owner, contents, ownerX, ownerY); } switch(popupType) { case LIGHT_WEIGHT_POPUP: return getLightWeightPopup(owner, contents, ownerX, ownerY); case MEDIUM_WEIGHT_POPUP: return getMediumWeightPopup(owner, contents, ownerX, ownerY); case HEAVY_WEIGHT_POPUP: Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY); if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) && (owner != null) && (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) { ((HeavyWeightPopup)popup).setCacheEnabled(false); } return popup; } return null; }
Example #17
Source File: bug6550546.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) { System.out.println("The test is suitable only for Windows, skipped."); return; } SwingUtilities.invokeAndWait(new Runnable() { public void run() { File[] files = (File[]) ShellFolder.get("fileChooserComboBoxFolders"); for (File file : files) { if (file instanceof ShellFolder && ((ShellFolder) file).isLink()) { throw new RuntimeException("Link shouldn't be in FileChooser combobox, " + file.getPath()); } } } }); }
Example #18
Source File: bug8046391.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { OSType type = OSInfo.getOSType(); if (type != OSType.WINDOWS) { System.out.println("This test is for Windows only... skipping!"); return; } SwingUtilities.invokeAndWait(() -> { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } System.out.println("Creating JFileChooser..."); JFileChooser fileChooser = new JFileChooser(); System.out.println("Test passed: chooser = " + fileChooser); }); // Test fails if creating JFileChooser hangs }
Example #19
Source File: bug4251301.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) { System.out.println("This test is not applicable for MacOS. Passed."); return; } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.invokeAndWait(new Runnable() { public void run() { createAndShowGUI(); } }); toolkit.realSync(); test.waitTestResult(); }
Example #20
Source File: bug7154841.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { return; // Test only for Mac OS X } try { Robot r = new Robot(); r.setAutoDelay(100); r.setAutoWaitForIdle(true); r.mouseMove(0, 0); SwingUtilities.invokeAndWait(bug7154841::initAndShowUI); sleep(); SwingUtilities.invokeAndWait(() -> { popupMenu.show(frame, frame.getX() + frame.getWidth() / 2, frame.getY() + frame.getHeight() / 2); }); sleep(); int y = (int)screenBounds.get().getY() + (int)screenBounds.get().getHeight() - 10; int center = (int)(screenBounds.get().getX() + screenBounds.get().getWidth() / 2); for (int x = center - 10 * STEP; x < center + 10 * STEP; x += STEP) { r.mouseMove(x, y); } if (!passed) { throw new RuntimeException("Failed: no mouse events on the popup menu"); } } finally { SwingUtilities.invokeLater(() -> { if (frame != null) { frame.dispose(); } }); } }
Example #21
Source File: bug6579827.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS || OSInfo.getWindowsVersion() != OSInfo.WINDOWS_VISTA) { System.out.println("This test is only for Windows Vista. Skipped."); return; } SwingUtilities.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 0); Dimension prefferdSize = slider.getPreferredSize(); slider.setPaintTrack(false); slider.putClientProperty("Slider.paintThumbArrowShape", Boolean.TRUE); if (prefferdSize.equals(slider.getPreferredSize())) { throw new RuntimeException(); } } }); }
Example #22
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 #23
Source File: WTaskbarPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static synchronized void init() { if (!initExecuted) { supported = OSInfo.getWindowsVersion() .compareTo(OSInfo.WINDOWS_7) >= 0 && ShellFolder.invoke(() -> nativeInit()); } initExecuted = true; }
Example #24
Source File: WindowsLookAndFeel.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public void initialize() { super.initialize(); // Set the flag which determines which version of Windows should // be rendered. This flag only need to be set once. // if version <= 4.0 then the classic LAF should be loaded. if (OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_95) <= 0) { isClassicWindows = true; } else { isClassicWindows = false; XPStyle.invalidateStyle(); } // Using the fonts set by the user can potentially cause // performance and compatibility issues, so allow this feature // to be switched off either at runtime or programmatically // String systemFonts = java.security.AccessController.doPrivileged( new GetPropertyAction("swing.useSystemFontSettings")); useSystemFontSettings = (systemFonts == null || Boolean.valueOf(systemFonts).booleanValue()); if (useSystemFontSettings) { Object value = UIManager.get("Application.useSystemFontSettings"); useSystemFontSettings = (value == null || Boolean.TRUE.equals(value)); } KeyboardFocusManager.getCurrentKeyboardFocusManager(). addKeyEventPostProcessor(WindowsRootPaneUI.altProcessor); }
Example #25
Source File: bug6579827.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS || OSInfo.getWindowsVersion() != OSInfo.WINDOWS_VISTA) { System.out.println("This test is only for Windows Vista. Skipped."); return; } SwingUtilities.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 0); Dimension prefferdSize = slider.getPreferredSize(); slider.setPaintTrack(false); slider.putClientProperty("Slider.paintThumbArrowShape", Boolean.TRUE); if (prefferdSize.equals(slider.getPreferredSize())) { throw new RuntimeException(); } } }); }
Example #26
Source File: bug6579827.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS || OSInfo.getWindowsVersion() != OSInfo.WINDOWS_VISTA) { System.out.println("This test is only for Windows Vista. Skipped."); return; } SwingUtilities.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 0); Dimension prefferdSize = slider.getPreferredSize(); slider.setPaintTrack(false); slider.putClientProperty("Slider.paintThumbArrowShape", Boolean.TRUE); if (prefferdSize.equals(slider.getPreferredSize())) { throw new RuntimeException(); } } }); }
Example #27
Source File: NSImageToMultiResolutionImageTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { return; } String icon = "NSImage://NSApplicationIcon"; final Image image = Toolkit.getDefaultToolkit().getImage(icon); if (!(image instanceof MultiResolutionImage)) { throw new RuntimeException("Icon does not have resolution variants!"); } MultiResolutionImage multiResolutionImage = (MultiResolutionImage) image; int width = 0; int height = 0; for (Image resolutionVariant : multiResolutionImage.getResolutionVariants()) { int rvWidth = resolutionVariant.getWidth(null); int rvHeight = resolutionVariant.getHeight(null); if (rvWidth < width || rvHeight < height) { throw new RuntimeException("Resolution variants are not sorted!"); } width = rvWidth; height = rvHeight; } }
Example #28
Source File: WindowsLookAndFeel.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void initialize() { super.initialize(); // Set the flag which determines which version of Windows should // be rendered. This flag only need to be set once. // if version <= 4.0 then the classic LAF should be loaded. if (OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_95) <= 0) { isClassicWindows = true; } else { isClassicWindows = false; XPStyle.invalidateStyle(); } // Using the fonts set by the user can potentially cause // performance and compatibility issues, so allow this feature // to be switched off either at runtime or programmatically // String systemFonts = java.security.AccessController.doPrivileged( new GetPropertyAction("swing.useSystemFontSettings")); useSystemFontSettings = (systemFonts == null || Boolean.valueOf(systemFonts).booleanValue()); if (useSystemFontSettings) { Object value = UIManager.get("Application.useSystemFontSettings"); useSystemFontSettings = (value == null || Boolean.TRUE.equals(value)); } KeyboardFocusManager.getCurrentKeyboardFocusManager(). addKeyEventPostProcessor(WindowsRootPaneUI.altProcessor); }
Example #29
Source File: bug4251301.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) { System.out.println("This test is not applicable for MacOS. Passed."); return; } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.invokeAndWait(new Runnable() { public void run() { createAndShowGUI(); } }); toolkit.realSync(); test.waitTestResult(); }
Example #30
Source File: DeadKeyMacOSXInputText.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { return; } toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); Robot robot = new Robot(); robot.setAutoDelay(50); createAndShowGUI(); // Pressed keys: Alt + E + A // Results: ALT + VK_DEAD_ACUTE + a with accute accent robot.keyPress(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_E); robot.keyRelease(KeyEvent.VK_E); robot.keyRelease(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_A); robot.keyRelease(KeyEvent.VK_A); toolkit.realSync(); if (state != 3) { throw new RuntimeException("Wrong number of key events."); } }