8169954: JFileChooser/8021253: java.lang.RuntimeException: Default button is not pressed
Reviewed-by: serb
This commit is contained in:
parent
7597cba92b
commit
cacce843aa
@ -768,7 +768,6 @@ javax/swing/text/JTextComponent/5074573/bug5074573.java 8196100 windows-all
|
|||||||
javax/swing/JFileChooser/6798062/bug6798062.java 8146446 windows-all
|
javax/swing/JFileChooser/6798062/bug6798062.java 8146446 windows-all
|
||||||
javax/swing/JComboBox/8182031/ComboPopupTest.java 8196465 linux-all,macosx-all
|
javax/swing/JComboBox/8182031/ComboPopupTest.java 8196465 linux-all,macosx-all
|
||||||
javax/swing/JFileChooser/6738668/bug6738668.java 8194946 generic-all
|
javax/swing/JFileChooser/6738668/bug6738668.java 8194946 generic-all
|
||||||
javax/swing/JFileChooser/8021253/bug8021253.java 8169954 windows-all,linux-all,macosx-all
|
|
||||||
javax/swing/JFileChooser/8062561/bug8062561.java 8196466 linux-all,macosx-all
|
javax/swing/JFileChooser/8062561/bug8062561.java 8196466 linux-all,macosx-all
|
||||||
javax/swing/JInternalFrame/Test6325652.java 8224977 macosx-all
|
javax/swing/JInternalFrame/Test6325652.java 8224977 macosx-all
|
||||||
javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java 8225045 linux-all
|
javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java 8225045 linux-all
|
||||||
|
@ -47,34 +47,41 @@ public class bug8021253 {
|
|||||||
private static volatile boolean defaultKeyPressed;
|
private static volatile boolean defaultKeyPressed;
|
||||||
private static JFileChooser fileChooser;
|
private static JFileChooser fileChooser;
|
||||||
private static File file;
|
private static File file;
|
||||||
|
private static JFrame frame;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.setAutoDelay(100);
|
||||||
|
|
||||||
Robot robot = new Robot();
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
robot.setAutoDelay(50);
|
public void run() {
|
||||||
|
createAndShowGUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
robot.waitForIdle();
|
||||||
public void run() {
|
robot.delay(1000);
|
||||||
createAndShowGUI();
|
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
fileChooser.setSelectedFile(file);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
|
robot.keyPress(KeyEvent.VK_ENTER);
|
||||||
|
robot.keyRelease(KeyEvent.VK_ENTER);
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
|
if (!defaultKeyPressed) {
|
||||||
|
throw new RuntimeException("Default button is not pressed");
|
||||||
}
|
}
|
||||||
});
|
} finally {
|
||||||
|
if (frame != null) {
|
||||||
robot.waitForIdle();
|
SwingUtilities.invokeAndWait(frame::dispose);
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
fileChooser.setSelectedFile(file);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
robot.waitForIdle();
|
|
||||||
|
|
||||||
robot.keyPress(KeyEvent.VK_ENTER);
|
|
||||||
robot.keyRelease(KeyEvent.VK_ENTER);
|
|
||||||
robot.waitForIdle();
|
|
||||||
|
|
||||||
if (!defaultKeyPressed) {
|
|
||||||
throw new RuntimeException("Default button is not pressed");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +89,7 @@ public class bug8021253 {
|
|||||||
|
|
||||||
file = getTempFile();
|
file = getTempFile();
|
||||||
|
|
||||||
final JFrame frame = new JFrame("Test");
|
frame = new JFrame("Test");
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
frame.setSize(200, 300);
|
frame.setSize(200, 300);
|
||||||
|
|
||||||
@ -97,6 +104,7 @@ public class bug8021253 {
|
|||||||
|
|
||||||
frame.getContentPane().add(BorderLayout.CENTER, fileChooser);
|
frame.getContentPane().add(BorderLayout.CENTER, fileChooser);
|
||||||
frame.setSize(fileChooser.getPreferredSize());
|
frame.setSize(fileChooser.getPreferredSize());
|
||||||
|
frame.setLocationRelativeTo(null);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user