Skip to content

Commit

Permalink
8294067: [macOS] javax/swing/JComboBox/6559152/bug6559152.java Cannot…
Browse files Browse the repository at this point in the history
… select an item from popup with the ENTER key.

Reviewed-by: azvegint, psadhukhan
  • Loading branch information
Damon Nguyen authored and Alexander Zvegintsev committed Sep 20, 2022
1 parent caae53f commit 3b438a6
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/jdk/javax/swing/JComboBox/6559152/bug6559152.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -69,6 +72,7 @@ static void blockTillDisplayed(JComponent comp) throws Exception {
try {
SwingUtilities.invokeAndWait(() -> {
p = comp.getLocationOnScreen();
d = comp.getSize();
});
} catch (IllegalStateException e) {
try {
Expand Down Expand Up @@ -97,7 +101,7 @@ private static void setupUI() {
}

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);
Expand Down

3 comments on commit 3b438a6

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 3b438a6 Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 3b438a6 Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch backport-GoeLin-3b438a68-master in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 3b438a68 from the openjdk/jdk repository.

The commit being backported was authored by Damon Nguyen on 20 Sep 2022 and was reviewed by Alexander Zvegintsev and Prasanta Sadhukhan.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git backport-GoeLin-3b438a68-master:backport-GoeLin-3b438a68-master
$ git checkout backport-GoeLin-3b438a68-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git backport-GoeLin-3b438a68-master

Please sign in to comment.