當前位置: 首頁>>代碼示例>>Java>>正文


Java JTableHeader.getLocationOnScreen方法代碼示例

本文整理匯總了Java中javax.swing.table.JTableHeader.getLocationOnScreen方法的典型用法代碼示例。如果您正苦於以下問題:Java JTableHeader.getLocationOnScreen方法的具體用法?Java JTableHeader.getLocationOnScreen怎麽用?Java JTableHeader.getLocationOnScreen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.table.JTableHeader的用法示例。


在下文中一共展示了JTableHeader.getLocationOnScreen方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import javax.swing.table.JTableHeader; //導入方法依賴的package包/類
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");
            }
        });
    }
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:36,代碼來源:bug6884066.java

示例2: main

import javax.swing.table.JTableHeader; //導入方法依賴的package包/類
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");
            }
        });
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:35,代碼來源:bug6884066.java

示例3: main

import javax.swing.table.JTableHeader; //導入方法依賴的package包/類
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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:44,代碼來源:bug6777378.java

示例4: main

import javax.swing.table.JTableHeader; //導入方法依賴的package包/類
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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:43,代碼來源:bug6777378.java


注:本文中的javax.swing.table.JTableHeader.getLocationOnScreen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。