@@ -50,23 +50,28 @@ public class SelectEditTableCell {
5050
5151 public static void main (String [] args ) throws Exception {
5252 robot = new Robot ();
53- robot .delay ( 2000 );
53+ robot .setAutoDelay ( 100 );
5454 UIManager .LookAndFeelInfo [] lookAndFeelArray
5555 = UIManager .getInstalledLookAndFeels ();
5656 for (UIManager .LookAndFeelInfo lookAndFeelItem : lookAndFeelArray ) {
5757 executeCase (lookAndFeelItem .getClassName ());
5858 }
59-
6059 }
6160
6261 private static void executeCase (String lookAndFeelString ) throws Exception {
63- if (tryLookAndFeel (lookAndFeelString )) {
64- createUI (lookAndFeelString );
65- robot .delay (2000 );
66- runTestCase ();
67- robot .delay (2000 );
68- cleanUp ();
69- robot .delay (2000 );
62+ try {
63+ if (tryLookAndFeel (lookAndFeelString )) {
64+ createUI (lookAndFeelString );
65+ robot .delay (2000 );
66+ runTestCase ();
67+ robot .delay (2000 );
68+ cleanUp ();
69+ robot .delay (2000 );
70+ }
71+ } finally {
72+ if (frame != null ) {
73+ SwingUtilities .invokeAndWait (frame ::dispose );
74+ }
7075 }
7176
7277 }
@@ -100,6 +105,7 @@ private static void runTestCase() throws Exception {
100105 robot .mouseMove (centerPoint .x , centerPoint .y );
101106 robot .mousePress (InputEvent .BUTTON1_MASK );
102107 robot .mouseRelease (InputEvent .BUTTON1_MASK );
108+ robot .waitForIdle ();
103109 SwingUtilities .invokeAndWait (new Runnable () {
104110 @ Override
105111 public void run () {
@@ -112,7 +118,7 @@ public void run() {
112118 }
113119 }
114120 });
115- robot . waitForIdle ();
121+
116122 int fetchKeyCode ;
117123 keyTap (fetchKeyCode = isMac (lookAndFeel )
118124 ? KeyEvent .VK_ENTER : KeyEvent .VK_SPACE );
@@ -129,7 +135,7 @@ public void run() {
129135 }
130136 }
131137 });
132- robot . waitForIdle ();
138+
133139 keyTap (KeyEvent .VK_SPACE );
134140 robot .waitForIdle ();
135141 SwingUtilities .invokeAndWait (new Runnable () {
@@ -149,10 +155,12 @@ public void run() {
149155 }
150156 }
151157 });
152- robot . waitForIdle ();
158+
153159 // hitting a letter key will start editing
154160 keyTap (KeyEvent .VK_A );
161+ robot .waitForIdle ();
155162 keyTap (KeyEvent .VK_SPACE );
163+ robot .waitForIdle ();
156164 keyTap (KeyEvent .VK_A );
157165 robot .waitForIdle ();
158166 SwingUtilities .invokeAndWait (new Runnable () {
0 commit comments