@@ -50,23 +50,28 @@ public class SelectEditTableCell {
50
50
51
51
public static void main (String [] args ) throws Exception {
52
52
robot = new Robot ();
53
- robot .delay ( 2000 );
53
+ robot .setAutoDelay ( 100 );
54
54
UIManager .LookAndFeelInfo [] lookAndFeelArray
55
55
= UIManager .getInstalledLookAndFeels ();
56
56
for (UIManager .LookAndFeelInfo lookAndFeelItem : lookAndFeelArray ) {
57
57
executeCase (lookAndFeelItem .getClassName ());
58
58
}
59
-
60
59
}
61
60
62
61
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
+ }
70
75
}
71
76
72
77
}
@@ -100,6 +105,7 @@ private static void runTestCase() throws Exception {
100
105
robot .mouseMove (centerPoint .x , centerPoint .y );
101
106
robot .mousePress (InputEvent .BUTTON1_MASK );
102
107
robot .mouseRelease (InputEvent .BUTTON1_MASK );
108
+ robot .waitForIdle ();
103
109
SwingUtilities .invokeAndWait (new Runnable () {
104
110
@ Override
105
111
public void run () {
@@ -112,7 +118,7 @@ public void run() {
112
118
}
113
119
}
114
120
});
115
- robot . waitForIdle ();
121
+
116
122
int fetchKeyCode ;
117
123
keyTap (fetchKeyCode = isMac (lookAndFeel )
118
124
? KeyEvent .VK_ENTER : KeyEvent .VK_SPACE );
@@ -129,7 +135,7 @@ public void run() {
129
135
}
130
136
}
131
137
});
132
- robot . waitForIdle ();
138
+
133
139
keyTap (KeyEvent .VK_SPACE );
134
140
robot .waitForIdle ();
135
141
SwingUtilities .invokeAndWait (new Runnable () {
@@ -149,10 +155,12 @@ public void run() {
149
155
}
150
156
}
151
157
});
152
- robot . waitForIdle ();
158
+
153
159
// hitting a letter key will start editing
154
160
keyTap (KeyEvent .VK_A );
161
+ robot .waitForIdle ();
155
162
keyTap (KeyEvent .VK_SPACE );
163
+ robot .waitForIdle ();
156
164
keyTap (KeyEvent .VK_A );
157
165
robot .waitForIdle ();
158
166
SwingUtilities .invokeAndWait (new Runnable () {
0 commit comments