Java Code Examples for com.sun.java.swing.plaf.windows.WindowsLookAndFeel

The following examples show how to use com.sun.java.swing.plaf.windows.WindowsLookAndFeel. 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: dragonwell8_jdk   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 2
Source Project: dragonwell8_jdk   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 3
Source Project: TencentKona-8   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 4
Source Project: TencentKona-8   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 5
Source Project: jdk8u60   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 6
Source Project: jdk8u60   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 7
Source Project: openjdk-jdk8u   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 8
Source Project: openjdk-jdk8u   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 9
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
}
 
Example 10
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);
}
 
Example 11
Source Project: openjdk-jdk9   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 12
Source Project: openjdk-jdk9   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 13
Source Project: jdk8u-jdk   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 14
Source Project: jdk8u-jdk   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 15
Source Project: hottub   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 16
Source Project: hottub   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 17
Source Project: openjdk-8-source   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 18
Source Project: openjdk-8   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 19
Source Project: jdk8u_jdk   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 20
Source Project: jdk8u_jdk   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 21
Source Project: jdk8u-jdk   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 22
Source Project: jdk8u-jdk   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 23
Source Project: jdk8u-dev-jdk   Source File: bug8046391.java    License: GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example 24
Source Project: jdk8u-dev-jdk   Source File: bug6524424.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 25
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 6 votes vote down vote up
private MainPanel() {
  super();
  showMnemonicsCheck.setSelected(UIManager.getBoolean(SHOW_MNEMONICS));
  showMnemonicsCheck.setMnemonic(KeyEvent.VK_B);
  showMnemonicsCheck.addActionListener(e -> {
    UIManager.put(SHOW_MNEMONICS, ((JCheckBox) e.getSource()).isSelected());
    if (UIManager.getLookAndFeel() instanceof WindowsLookAndFeel) {
      // System.out.println("isMnemonicHidden: " + WindowsLookAndFeel.isMnemonicHidden());
      WindowsLookAndFeel.setMnemonicHidden(true);
      // SwingUtilities.getRoot(this).repaint();
      Container c = getTopLevelAncestor();
      if (c != null) {
        c.repaint();
      }
    }
  });
  add(showMnemonicsCheck);

  JButton button = new JButton("Dummy");
  button.setMnemonic(KeyEvent.VK_D);
  add(button);

  EventQueue.invokeLater(() -> getRootPane().setJMenuBar(createMenuBar()));

  setPreferredSize(new Dimension(320, 240));
}
 
Example 26
Source Project: dragonwell8_jdk   Source File: bug8004298.java    License: GNU General Public License v2.0 5 votes vote down vote up
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();

}
 
Example 27
Source Project: TencentKona-8   Source File: bug8004298.java    License: GNU General Public License v2.0 5 votes vote down vote up
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();

}
 
Example 28
Source Project: jdk8u60   Source File: bug8004298.java    License: GNU General Public License v2.0 5 votes vote down vote up
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();

}
 
Example 29
Source Project: openjdk-jdk8u   Source File: bug8004298.java    License: GNU General Public License v2.0 5 votes vote down vote up
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();

}
 
Example 30
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();

}