3939 * @test
4040 * @key headful
4141 * @bug 8072767
42- * @author Alexander Scherbatiy
4342 * @summary DefaultCellEditor for comboBox creates ActionEvent with wrong source
4443 * object
4544 * @run main bug8072767
@@ -52,22 +51,23 @@ public class bug8072767 {
5251
5352 private static JFrame frame ;
5453 private static JTable table ;
55- private static Point point ;
54+ private static volatile Point point ;
5655 private static boolean testPass ;
5756
5857 public static void main (String [] args ) throws Exception {
5958 Robot robot = new Robot ();
60- robot .setAutoDelay (50 );
59+ robot .setAutoDelay (100 );
6160 SwingUtilities .invokeAndWait (bug8072767 ::createAndShowGUI );
6261 robot .waitForIdle ();
62+ robot .delay (1000 );
6363 SwingUtilities .invokeAndWait (() -> {
6464 point = table .getLocationOnScreen ();
6565 Rectangle rect = table .getCellRect (0 , 0 , true );
6666 point .translate (rect .width / 2 , rect .height / 2 );
6767 });
6868 robot .mouseMove (point .x , point .y );
69- robot .mousePress (InputEvent .BUTTON1_MASK );
70- robot .mouseRelease (InputEvent .BUTTON1_MASK );
69+ robot .mousePress (InputEvent .BUTTON1_DOWN_MASK );
70+ robot .mouseRelease (InputEvent .BUTTON1_DOWN_MASK );
7171 robot .waitForIdle ();
7272
7373 robot .keyPress (KeyEvent .VK_1 );
@@ -80,8 +80,8 @@ public static void main(String[] args) throws Exception {
8080 });
8181
8282 robot .mouseMove (point .x , point .y );
83- robot .mousePress (InputEvent .BUTTON1_MASK );
84- robot .mouseRelease (InputEvent .BUTTON1_MASK );
83+ robot .mousePress (InputEvent .BUTTON1_DOWN_MASK );
84+ robot .mouseRelease (InputEvent .BUTTON1_DOWN_MASK );
8585 robot .waitForIdle ();
8686
8787 SwingUtilities .invokeAndWait (() -> {
@@ -98,7 +98,6 @@ private static void createAndShowGUI() {
9898 frame = new JFrame ();
9999 frame .setDefaultCloseOperation (JFrame .EXIT_ON_CLOSE );
100100 frame .setSize (200 , 200 );
101- frame .setLocation (100 , 100 );
102101
103102 table = new JTable (
104103 new String [][]{{TEST1 }}, new String []{"Header" });
@@ -108,5 +107,6 @@ private static void createAndShowGUI() {
108107 new DefaultCellEditor (comboBox ));
109108 frame .getContentPane ().add (table );
110109 frame .setVisible (true );
110+ frame .setLocationRelativeTo (null );
111111 }
112112}
0 commit comments