test/javax/swing/JRadioButton/8075609/bug8075609.java
Print this page
*** 33,47 ****
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.*;
- import sun.awt.SunToolkit;
public class bug8075609 {
private static Robot robot;
- private static SunToolkit toolkit;
private static JTextField textField;
public static void main(String args[]) throws Throwable {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
--- 33,45 ----
*** 51,61 ****
robot = new Robot();
Thread.sleep(100);
robot.setAutoDelay(100);
- toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
// Radio button group tab key test
runTest1();
}
--- 49,58 ----
*** 94,115 ****
// Radio button Group as a single component when traversing through tab key
private static void runTest1() throws Exception{
hitKey(robot, KeyEvent.VK_TAB);
! robot.setAutoDelay(1000 );
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
! if (textField.hasFocus()) {
System.out.println("Radio Button Group Go To Next Component through Tab Key failed");
throw new RuntimeException("Focus is not on textField as Expected");
}
}
});
}
private static void hitKey(Robot robot, int keycode) {
robot.keyPress(keycode);
robot.keyRelease(keycode);
! toolkit.realSync();
}
}
--- 91,112 ----
// Radio button Group as a single component when traversing through tab key
private static void runTest1() throws Exception{
hitKey(robot, KeyEvent.VK_TAB);
! robot.delay(1000 );
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
! if (!textField.hasFocus()) {
System.out.println("Radio Button Group Go To Next Component through Tab Key failed");
throw new RuntimeException("Focus is not on textField as Expected");
}
}
});
}
private static void hitKey(Robot robot, int keycode) {
robot.keyPress(keycode);
robot.keyRelease(keycode);
! robot.waitForIdle();
}
}