Search in sources :

Example 1 with WindowsLookAndFeel

use of com.sun.java.swing.plaf.windows.WindowsLookAndFeel in project jdk8u_jdk by JetBrains.

the class bug6524424 method main.

public static void main(String[] args) {
    try {
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
        return;
    }
    TestPanel panel = new TestPanel();
    JFrame frame = new JFrame();
    frame.setContentPane(panel);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
Also used : WindowsLookAndFeel(com.sun.java.swing.plaf.windows.WindowsLookAndFeel)

Example 2 with WindowsLookAndFeel

use of com.sun.java.swing.plaf.windows.WindowsLookAndFeel in project jdk8u_jdk by JetBrains.

the class bug8046391 method main.

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
}
Also used : UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) JFileChooser(javax.swing.JFileChooser) OSType(sun.awt.OSInfo.OSType) WindowsLookAndFeel(com.sun.java.swing.plaf.windows.WindowsLookAndFeel)

Example 3 with WindowsLookAndFeel

use of com.sun.java.swing.plaf.windows.WindowsLookAndFeel in project jdk8u_jdk by JetBrains.

the class bug8004298 method main.

public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    robot.setAutoDelay(50);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    try {
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
    } catch (javax.swing.UnsupportedLookAndFeelException ulafe) {
        System.out.println(ulafe.getMessage());
        System.out.println("The test is considered PASSED");
        return;
    }
    SwingUtilities.invokeAndWait(new Runnable() {

        @Override
        public void run() {
            createAndShowGUI();
        }
    });
    toolkit.realSync();
    Point point = Util.invokeOnEDT(new Callable<Point>() {

        @Override
        public Point call() throws Exception {
            Rectangle rect = tree.getRowBounds(2);
            Point p = new Point(rect.x + rect.width / 2, rect.y + rect.height / 2);
            SwingUtilities.convertPointToScreen(p, tree);
            return p;
        }
    });
    robot.mouseMove(point.x, point.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    toolkit.realSync();
}
Also used : javax.swing(javax.swing) SunToolkit(sun.awt.SunToolkit) WindowsLookAndFeel(com.sun.java.swing.plaf.windows.WindowsLookAndFeel)

Aggregations

WindowsLookAndFeel (com.sun.java.swing.plaf.windows.WindowsLookAndFeel)3 javax.swing (javax.swing)1 JFileChooser (javax.swing.JFileChooser)1 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)1 OSType (sun.awt.OSInfo.OSType)1 SunToolkit (sun.awt.SunToolkit)1