Search in sources :

Example 86 with SunToolkit

use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.

the class bug7055065 method main.

public static void main(String[] args) throws Exception {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    Robot robot = new Robot();
    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            createAndShowUI();
        }
    });
    toolkit.realSync();
    clickCell(robot, 1, 1);
    Util.hitKeys(robot, KeyEvent.VK_BACK_SPACE, KeyEvent.VK_BACK_SPACE, KeyEvent.VK_BACK_SPACE);
    toolkit.realSync();
    clickColumnHeader(robot, 1);
    toolkit.realSync();
    clickColumnHeader(robot, 1);
}
Also used : SunToolkit(sun.awt.SunToolkit) Robot(java.awt.Robot)

Example 87 with SunToolkit

use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.

the class bug8036819 method main.

public static void main(String[] args) throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            createAndShowGUI();
        }
    });
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();
    Robot robo = new Robot();
    robo.setAutoDelay(300);
    // Using mnemonic key to focus on the textfield
    Util.hitMnemonics(robo, KeyEvent.VK_P);
    toolkit.realSync();
    if (!passed) {
        throw new RuntimeException("Test failed.");
    }
}
Also used : SunToolkit(sun.awt.SunToolkit)

Example 88 with SunToolkit

use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.

the class bug4247996 method main.

public static void main(String[] args) throws Exception {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    Robot robot = new Robot();
    robot.setAutoDelay(50);
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    javax.swing.SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            createAndShowGUI();
        }
    });
    toolkit.realSync();
    Point point = getButtonCenter();
    robot.mouseMove(point.x, point.y);
    toolkit.realSync();
    checkButtonsSize();
}
Also used : SunToolkit(sun.awt.SunToolkit)

Example 89 with SunToolkit

use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.

the class bug6777378 method main.

public static void main(String[] args) throws Exception {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    Robot robot = new Robot();
    robot.setAutoDelay(20);
    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            try {
                UIManager.setLookAndFeel(new MetalLookAndFeel());
            } catch (Exception e) {
                e.printStackTrace();
            }
            JTable table = new JTable(new AbstractTableModel() {

                public int getRowCount() {
                    return 10;
                }

                public int getColumnCount() {
                    return 10;
                }

                public Object getValueAt(int rowIndex, int columnIndex) {
                    return "" + rowIndex + " " + columnIndex;
                }
            });
            header = new JTableHeader(table.getColumnModel());
            header.setToolTipText("hello");
            frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(header);
            frame.setSize(300, 300);
            frame.setVisible(true);
        }
    });
    toolkit.realSync();
    Point point = header.getLocationOnScreen();
    robot.mouseMove(point.x + 20, point.y + 50);
    robot.mouseMove(point.x + 30, point.y + 50);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
Also used : SunToolkit(sun.awt.SunToolkit) JTableHeader(javax.swing.table.JTableHeader) AbstractTableModel(javax.swing.table.AbstractTableModel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel)

Example 90 with SunToolkit

use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.

the class bug6495408 method main.

public static void main(String[] args) throws Exception {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    final Robot robot = new Robot();
    robot.setAutoDelay(50);
    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            final JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            tabbedPane = new JTabbedPane();
            tabbedPane.setTabPlacement(JTabbedPane.LEFT);
            tabbedPane.addTab("Hello", null);
            frame.add(tabbedPane);
            frame.setSize(400, 400);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    toolkit.realSync();
    final Rectangle d = new Rectangle();
    final Point p = new Point();
    for (int i = 0; i < 7; i++) {
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                int tab = tabbedPane.getTabCount() - 1;
                Rectangle bounds = tabbedPane.getBoundsAt(tab);
                if (bounds != null) {
                    d.setBounds(bounds);
                    p.setLocation(d.x + d.width / 2, d.y + d.height / 2);
                    SwingUtilities.convertPointToScreen(p, tabbedPane);
                    robot.mouseMove(p.x, p.y + d.height);
                    tabbedPane.addTab("Hello", null);
                }
            }
        });
    }
}
Also used : SunToolkit(sun.awt.SunToolkit)

Aggregations

SunToolkit (sun.awt.SunToolkit)120 Robot (java.awt.Robot)26 Point (java.awt.Point)9 Frame (java.awt.Frame)7 JFrame (javax.swing.JFrame)7 BufferedImage (java.awt.image.BufferedImage)5 Rectangle (java.awt.Rectangle)4 FlowLayout (java.awt.FlowLayout)3 TextField (java.awt.TextField)3 Toolkit (java.awt.Toolkit)3 MouseEvent (java.awt.event.MouseEvent)3 JTableHeader (javax.swing.table.JTableHeader)3 Component (java.awt.Component)2 KeyEvent (java.awt.event.KeyEvent)2 VolatileImage (java.awt.image.VolatileImage)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 File (java.io.File)2 IOException (java.io.IOException)2 Field (java.lang.reflect.Field)2 URL (java.net.URL)2