Java Code Examples for javax.swing.table.JTableHeader#getLocationOnScreen()

The following examples show how to use javax.swing.table.JTableHeader#getLocationOnScreen() . 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: bug6884066.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        toolkit.realSync();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 2
Source File: bug6884066.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        toolkit.realSync();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 3
Source File: bug6884066.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        toolkit.realSync();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 4
Source File: bug6884066.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        toolkit.realSync();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 5
Source File: bug6884066.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        toolkit.realSync();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 6
Source File: bug6884066.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        toolkit.realSync();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 7
Source File: bug6884066.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        toolkit.realSync();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 8
Source File: bug6884066.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        robot.waitForIdle();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 9
Source File: bug6884066.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(20);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // just to quickly grab a column model
                JTable table = new JTable(10, 5);
                header = new JTableHeader(table.getColumnModel());
                checkColumn(0, "A");
                JFrame frame = new JFrame("standalone header");
                frame.add(header);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        toolkit.realSync();
        Point point = header.getLocationOnScreen();
        robot.mouseMove(point.x + 3, point.y + 3);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        for (int i = 0; i < header.getWidth() - 3; i++) {
            robot.mouseMove(point.x + i, point.y + 3);
        }
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                TableColumnModel model = header.getColumnModel();
                checkColumn(model.getColumnCount() - 1, "A");
            }
        });
    }
 
Example 10
Source File: bug6777378.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 11
Source File: bug6777378.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 12
Source File: bug6777378.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 13
Source File: bug6777378.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 14
Source File: bug6777378.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    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);
        }
    });
    robot.waitForIdle();
    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);
}
 
Example 15
Source File: bug6777378.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 16
Source File: bug6777378.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 17
Source File: bug6777378.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 18
Source File: bug6777378.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 19
Source File: bug6777378.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 20
Source File: bug6777378.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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);
}