8294067: [macOS] javax/swing/JComboBox/6559152/bug6559152.java Cannot select an item from popup with the ENTER key.
Reviewed-by: azvegint, psadhukhan
This commit is contained in:
parent
caae53f4da
commit
3b438a68ea
@ -24,29 +24,32 @@
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 6559152
|
||||
* @bug 6559152 8294067
|
||||
* @summary Checks that you can select an item in JComboBox with keyboard
|
||||
* when it is a JTable cell editor.
|
||||
* @run main bug6559152
|
||||
*/
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.DefaultCellEditor;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.JTable;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.Robot;
|
||||
|
||||
public class bug6559152 {
|
||||
private static JFrame frame;
|
||||
private static JComboBox cb;
|
||||
private static Robot robot;
|
||||
private static Point p = null;
|
||||
private static Dimension d;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
@ -69,6 +72,7 @@ public class bug6559152 {
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
p = comp.getLocationOnScreen();
|
||||
d = comp.getSize();
|
||||
});
|
||||
} catch (IllegalStateException e) {
|
||||
try {
|
||||
@ -97,7 +101,7 @@ public class bug6559152 {
|
||||
}
|
||||
|
||||
private static void test() throws Exception {
|
||||
robot.mouseMove(p.x, p.y);
|
||||
robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2);
|
||||
robot.waitForIdle();
|
||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
|
Loading…
Reference in New Issue
Block a user