-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
8, 11, 17, 21
-
x86_64
-
os_x
ADDITIONAL SYSTEM INFORMATION :
MacBook Pro 2019 / macOS Sonoma 14.1.2
The bug is reproducible except for versions 1.8, 20.0.1, 21.0.1, 22-ea+29, and 23-ea+3.
A DESCRIPTION OF THE PROBLEM :
When the bug reproduces, the java awt runtime (at least I think it's an awt problem, not a javax problem) will not dispatch a bound key's action if (a) the bound key is VK_UP with ALT_DOWN_MASK and (b) the keyboard's right-hand [option] key is pressed. If the keyboard's left-hand [option] key is pressed then the action *is* dispatched.
REGRESSION : Last worked in version 8
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
0. Install good and bad java homes on a MacBook Pro
1. <BadJavaHome>/bin/java Test
2. Put focus on the JTextField
3. Press and hold the left-hand [option] key and then press the up arrow key
4. Press and hold the right-hand [option] key and then press the up arrow key
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code should print the java version and then for steps 3 and 4, the code should print
ALT UP
each time [option] [up] is pressed.
ACTUAL -
When a bad java home is used, ALT UP is printed only for the left-hand [option] key.
When a good java home is used, ALT UP is printed for both [option] keys.
---------- BEGIN SOURCE ----------
import java.awt.event.*;
import javax.swing.*;
public class Test extends JFrame {
public Test () {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
System.out.println(System.getProperty("java.version"));
JTextField tf = new JTextField();
add(tf);
pack();
Action dispatchUp = new AbstractAction() {
public void actionPerformed (ActionEvent ev) {
System.out.println("ALT UP");
}
};
tf.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK), dispatchUp);
setVisible(true);
}
public static void main (final String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Test t = new Test();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I know of no workaround except to force the user to use specific versions of Java (i.e., 1.8, 20, and 21).
I would like you to backport the code from version 20 to versions 17 through 19.
FREQUENCY : always
MacBook Pro 2019 / macOS Sonoma 14.1.2
The bug is reproducible except for versions 1.8, 20.0.1, 21.0.1, 22-ea+29, and 23-ea+3.
A DESCRIPTION OF THE PROBLEM :
When the bug reproduces, the java awt runtime (at least I think it's an awt problem, not a javax problem) will not dispatch a bound key's action if (a) the bound key is VK_UP with ALT_DOWN_MASK and (b) the keyboard's right-hand [option] key is pressed. If the keyboard's left-hand [option] key is pressed then the action *is* dispatched.
REGRESSION : Last worked in version 8
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
0. Install good and bad java homes on a MacBook Pro
1. <BadJavaHome>/bin/java Test
2. Put focus on the JTextField
3. Press and hold the left-hand [option] key and then press the up arrow key
4. Press and hold the right-hand [option] key and then press the up arrow key
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code should print the java version and then for steps 3 and 4, the code should print
ALT UP
each time [option] [up] is pressed.
ACTUAL -
When a bad java home is used, ALT UP is printed only for the left-hand [option] key.
When a good java home is used, ALT UP is printed for both [option] keys.
---------- BEGIN SOURCE ----------
import java.awt.event.*;
import javax.swing.*;
public class Test extends JFrame {
public Test () {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
System.out.println(System.getProperty("java.version"));
JTextField tf = new JTextField();
add(tf);
pack();
Action dispatchUp = new AbstractAction() {
public void actionPerformed (ActionEvent ev) {
System.out.println("ALT UP");
}
};
tf.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK), dispatchUp);
setVisible(true);
}
public static void main (final String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Test t = new Test();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I know of no workaround except to force the user to use specific versions of Java (i.e., 1.8, 20, and 21).
I would like you to backport the code from version 20 to versions 17 through 19.
FREQUENCY : always
- duplicates
-
JDK-8311922 [macOS] right-Option key fails to generate release event
- Resolved