mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 23:37:13 -06:00
Button: fixed behavior of Enter key on focused button on Windows and Linux, which now clicks the focused button (instead of the default button)
This commit is contained in:
@@ -14,6 +14,14 @@ FlatLaf Change Log
|
|||||||
|
|
||||||
#### Fixed bugs
|
#### Fixed bugs
|
||||||
|
|
||||||
|
- Button: Fixed behavior of <kbd>Enter</kbd> key on focused button on Windows
|
||||||
|
and Linux, which now clicks the focused button (instead of the default
|
||||||
|
button).
|
||||||
|
- On Windows, this is a regression in 1.0-rc1.
|
||||||
|
- On macOS, the <kbd>Enter</kbd> key always clicks the default button, which
|
||||||
|
is the platform behavior.
|
||||||
|
- On all platforms, the default button can be always clicked with
|
||||||
|
<kbd>Ctrl+Enter</kbd> keys, even if another button is focused.
|
||||||
- CheckBox and RadioButton: Fill component background as soon as background
|
- CheckBox and RadioButton: Fill component background as soon as background
|
||||||
color is different to default background color, even if component is not
|
color is different to default background color, even if component is not
|
||||||
opaque (which is the default). This paints selection if using the component as
|
opaque (which is the default). This paints selection if using the component as
|
||||||
|
|||||||
@@ -42,10 +42,12 @@ class FlatInputMaps
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void initBasicInputMaps( UIDefaults defaults ) {
|
private static void initBasicInputMaps( UIDefaults defaults ) {
|
||||||
defaults.put( "Button.focusInputMap", new UIDefaults.LazyInputMap( new Object[] {
|
if( SystemInfo.isMacOS ) {
|
||||||
"SPACE", "pressed",
|
defaults.put( "Button.focusInputMap", new UIDefaults.LazyInputMap( new Object[] {
|
||||||
"released SPACE", "released"
|
"SPACE", "pressed",
|
||||||
} ) );
|
"released SPACE", "released"
|
||||||
|
} ) );
|
||||||
|
}
|
||||||
|
|
||||||
modifyInputMap( defaults, "ComboBox.ancestorInputMap",
|
modifyInputMap( defaults, "ComboBox.ancestorInputMap",
|
||||||
"SPACE", "spacePopup",
|
"SPACE", "spacePopup",
|
||||||
|
|||||||
@@ -44,10 +44,12 @@ class NewDialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void okActionPerformed() {
|
private void okActionPerformed() {
|
||||||
|
System.out.println( "ok" );
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelActionPerformed() {
|
private void cancelActionPerformed() {
|
||||||
|
System.out.println( "cancel" );
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ OS Windows 10
|
|||||||
|
|
||||||
#---- Button ----
|
#---- Button ----
|
||||||
|
|
||||||
Button.focusInputMap [lazy] 2 javax.swing.plaf.InputMapUIResource [UI]
|
Button.focusInputMap [lazy] 4 javax.swing.plaf.InputMapUIResource [UI]
|
||||||
|
ENTER pressed
|
||||||
SPACE pressed
|
SPACE pressed
|
||||||
|
released ENTER released
|
||||||
released SPACE released
|
released SPACE released
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user