Java Code Examples for javax.swing.plaf.metal.MetalLookAndFeel

The following examples show how to use javax.swing.plaf.metal.MetalLookAndFeel. These examples are extracted from open source projects. 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 Project: hottub   Source File: bug7170310.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
        SwingUtilities.invokeAndWait(bug7170310::createAndShowUI);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.realSync();

        for (int i = 0; i < TABS_NUMBER; i++) {
            SwingUtilities.invokeAndWait(bug7170310::addTab);
            toolkit.realSync();
        }

        SwingUtilities.invokeAndWait(bug7170310::check);

        if (exception != null) {
            System.out.println("Test failed: " + exception.getMessage());
            throw exception;
        } else {
            System.out.printf("Test passed");
        }
    } finally {
        frame.dispose();
    }
}
 
Example 2
Source Project: jdk8u-dev-jdk   Source File: Test4783068.java    License: GNU General Public License v2.0 6 votes vote down vote up
void test() {
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        throw new Error("Cannot set Metal LAF");
    }
    // Render text using background color
    UIManager.put("textInactiveText", TEST_COLOR);

    test(new JLabel(html));
    test(new JButton(html));

    JEditorPane pane = new JEditorPane("text/html", html);
    pane.setDisabledTextColor(TEST_COLOR);
    test(pane);
}
 
Example 3
Source Project: openjdk-jdk9   Source File: bug7170310.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
        SwingUtilities.invokeAndWait(bug7170310::createAndShowUI);

        sync();

        for (int i = 0; i < TABS_NUMBER; i++) {
            SwingUtilities.invokeAndWait(bug7170310::addTab);
            sync();
        }

        SwingUtilities.invokeAndWait(bug7170310::check);

        if (exception != null) {
            System.out.println("Test failed: " + exception.getMessage());
            throw exception;
        } else {
            System.out.printf("Test passed");
        }
    } finally {
        frame.dispose();
    }
}
 
Example 4
Source Project: openjdk-8   Source File: Metalworks.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 5
Source Project: dragonwell8_jdk   Source File: Test8039750.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIDefaults table= new MetalLookAndFeel().getDefaults();
    test(table.get("ToolBar.rolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("ToolBar.nonrolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("RootPane.frameBorder"),
            "javax.swing.plaf.metal.MetalBorders$FrameBorder");
    test(table.get("RootPane.plainDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.informationDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.errorDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
    test(table.get("RootPane.colorChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.fileChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.questionDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.warningDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
}
 
Example 6
Source Project: TencentKona-8   Source File: Metalworks.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 7
Source Project: RipplePower   Source File: Baseline.java    License: Apache License 2.0 6 votes vote down vote up
private static boolean isOceanTheme() {
	if (!inSandbox) {
		try {
			java.lang.reflect.Field field = MetalLookAndFeel.class.getDeclaredField("currentTheme");
			field.setAccessible(true);
			Object theme = field.get(null);
			return "javax.swing.plaf.metal.OceanTheme".equals(theme.getClass().getName());
		} catch (Exception ex) {
			// We're in a sandbox and can't access the field
			inSandbox = true;
		}
	}
	if (!checkedForOcean) {
		checkedForOcean = true;
		checkForOcean();
	}
	return usingOcean;
}
 
Example 8
Source Project: TencentKona-8   Source File: Test4783068.java    License: GNU General Public License v2.0 6 votes vote down vote up
void test() {
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        throw new Error("Cannot set Metal LAF");
    }
    // Render text using background color
    UIManager.put("textInactiveText", TEST_COLOR);

    test(new JLabel(html));
    test(new JButton(html));

    JEditorPane pane = new JEditorPane("text/html", html);
    pane.setDisabledTextColor(TEST_COLOR);
    test(pane);
}
 
Example 9
Source Project: jdk8u-jdk   Source File: Test8039750.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIDefaults table= new MetalLookAndFeel().getDefaults();
    test(table.get("ToolBar.rolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("ToolBar.nonrolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("RootPane.frameBorder"),
            "javax.swing.plaf.metal.MetalBorders$FrameBorder");
    test(table.get("RootPane.plainDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.informationDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.errorDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
    test(table.get("RootPane.colorChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.fileChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.questionDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.warningDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
}
 
Example 10
Source Project: jdk8u_jdk   Source File: Metalworks.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 11
Source Project: jdk8u60   Source File: Metalworks.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 12
Source Project: jdk8u60   Source File: bug6342301.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example 13
Source Project: openjdk-8   Source File: Test4783068.java    License: GNU General Public License v2.0 6 votes vote down vote up
void test() {
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        throw new Error("Cannot set Metal LAF");
    }
    // Render text using background color
    UIManager.put("textInactiveText", TEST_COLOR);

    test(new JLabel(html));
    test(new JButton(html));

    JEditorPane pane = new JEditorPane("text/html", html);
    pane.setDisabledTextColor(TEST_COLOR);
    test(pane);
}
 
Example 14
public static void main(String[] args) {
    UIDefaults table= new MetalLookAndFeel().getDefaults();
    test(table.get("ToolBar.rolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("ToolBar.nonrolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("RootPane.frameBorder"),
            "javax.swing.plaf.metal.MetalBorders$FrameBorder");
    test(table.get("RootPane.plainDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.informationDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.errorDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
    test(table.get("RootPane.colorChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.fileChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.questionDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.warningDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
}
 
Example 15
/**
 * {@link WebLookAndFeel} installation and uninstallation test through {@link UIManager}.
 */
@Test
public void installUninstallBasic ()
{
    CoreSwingUtils.invokeAndWait ( new Runnable ()
    {
        @Override
        public void run ()
        {
            try
            {
                // Installing WebLookAndFeel
                UIManager.setLookAndFeel ( new WebLookAndFeel () );

                // Uninstalling WebLookAndFeel
                UIManager.setLookAndFeel ( MetalLookAndFeel.class.getCanonicalName () );
            }
            catch ( final Exception e )
            {
                throw new RuntimeException ( e );
            }
        }
    } );
}
 
Example 16
Source Project: openjdk-jdk9   Source File: Metalworks.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 17
Source Project: jdk8u-jdk   Source File: Metalworks.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
Example 18
Source Project: openjdk-jdk9   Source File: bug6342301.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example 19
Source Project: netbeans   Source File: PlatformInstallIteratorTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testSinglePlatformInstall () throws IOException, UnsupportedLookAndFeelException {
    UIManager.setLookAndFeel(new MetalLookAndFeel());
    InstallerRegistry regs = InstallerRegistryAccessor.prepareForUnitTest(new GeneralPlatformInstall[] {
        new FileBasedPlatformInstall ("FileBased1", Collections.<WizardDescriptor.Panel<WizardDescriptor>>singletonList(
            new Panel ("FileBased1_panel1")
        ))
    });
    PlatformInstallIterator iterator = PlatformInstallIterator.create();
    WizardDescriptor wd = new WizardDescriptor (iterator);
    iterator.initialize(wd);
    assertEquals("Invalid state", 1, iterator.getPanelIndex());
    WizardDescriptor.Panel panel = iterator.current();
    assertTrue ("Invalid panel",panel instanceof LocationChooser.Panel);
    ((JFileChooser)panel.getComponent()).setSelectedFile(this.getWorkDir());    //Select some folder
    assertTrue ("LocationChooser is not valid after folder was selected",panel.isValid());
    assertTrue ("Should have next panel",iterator.hasNext());
    assertFalse ("Should not have previous panel", iterator.hasPrevious());
    iterator.nextPanel();
    assertEquals("Invalid state", 2, iterator.getPanelIndex());
    panel = iterator.current();
    assertEquals("Invalid panel","FileBased1_panel1",panel.getComponent().getName());
    assertFalse ("Should not have next panel",iterator.hasNext());
    assertTrue ("Should have previous panel", iterator.hasPrevious());
}
 
Example 20
Source Project: jdk8u-jdk   Source File: Test8039750.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    UIDefaults table= new MetalLookAndFeel().getDefaults();
    test(table.get("ToolBar.rolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("ToolBar.nonrolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("RootPane.frameBorder"),
            "javax.swing.plaf.metal.MetalBorders$FrameBorder");
    test(table.get("RootPane.plainDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.informationDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.errorDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
    test(table.get("RootPane.colorChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.fileChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.questionDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.warningDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
}
 
Example 21
public void actionPerformed(ActionEvent e) {
    String numStr = e.getActionCommand();
    MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
    MetalLookAndFeel.setCurrentTheme(selectedTheme);
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
        System.out.println("Failed loading Metal");
        System.out.println(ex);
    }

}
 
Example 22
Source Project: jdk8u-jdk   Source File: Test6657026.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new MetalLookAndFeel());

    ThreadGroup group = new ThreadGroup("$$$");
    Thread thread = new Thread(group, new Test6657026());
    thread.start();
    thread.join();

    new JInternalFrame().setContentPane(new JPanel());
}
 
Example 23
Source Project: jdk8u-dev-jdk   Source File: bug6559589.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new MetalLookAndFeel());
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            bug6559589.createGui();
        }
    });
}
 
Example 24
Source Project: jdk8u-dev-jdk   Source File: bug6742358.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
 
Example 25
Source Project: jdk8u-jdk   Source File: bug8048506.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            createAndShowGUI();
        }
    });
    System.out.println("The test passed");
}
 
Example 26
Source Project: dragonwell8_jdk   Source File: bug7068740.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
        setUp();
        doTest();
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
        throw new RuntimeException("Test failed");
    }
}
 
Example 27
Source Project: jdk8u_jdk   Source File: bug6559589.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new MetalLookAndFeel());
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            bug6559589.createGui();
        }
    });
}
 
Example 28
Source Project: openjdk-8   Source File: bug7068740.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
        setUp();
        doTest();
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
        throw new RuntimeException("Test failed");
    }
}
 
Example 29
Source Project: jdk8u-jdk   Source File: MouseComboBoxTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    robot = new Robot();
    robot.setAutoDelay(50);

    UIManager.setLookAndFeel(new MetalLookAndFeel());
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            createAndShowGUI();
        }
    });
    toolkit.realSync();

    for (int i = 0; i < items.length; i++) {
        // Open popup
        robot.keyPress(KeyEvent.VK_DOWN);
        robot.keyRelease(KeyEvent.VK_DOWN);
        toolkit.realSync();

        Point point = getItemPointToClick(i);
        robot.mouseMove(point.x, point.y);
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        toolkit.realSync();

        if (i != getSelectedIndex()) {
            throw new RuntimeException("Test Failed! Incorrect value of selected index = " + getSelectedIndex() +
                    ", expected value = " + i);
        }
    }
}
 
Example 30
Source Project: openjdk-8   Source File: bug6742358.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}