mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 14: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
|
||||
|
||||
- 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
|
||||
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
|
||||
|
||||
@@ -42,10 +42,12 @@ class FlatInputMaps
|
||||
}
|
||||
|
||||
private static void initBasicInputMaps( UIDefaults defaults ) {
|
||||
defaults.put( "Button.focusInputMap", new UIDefaults.LazyInputMap( new Object[] {
|
||||
"SPACE", "pressed",
|
||||
"released SPACE", "released"
|
||||
} ) );
|
||||
if( SystemInfo.isMacOS ) {
|
||||
defaults.put( "Button.focusInputMap", new UIDefaults.LazyInputMap( new Object[] {
|
||||
"SPACE", "pressed",
|
||||
"released SPACE", "released"
|
||||
} ) );
|
||||
}
|
||||
|
||||
modifyInputMap( defaults, "ComboBox.ancestorInputMap",
|
||||
"SPACE", "spacePopup",
|
||||
|
||||
@@ -44,10 +44,12 @@ class NewDialog
|
||||
}
|
||||
|
||||
private void okActionPerformed() {
|
||||
System.out.println( "ok" );
|
||||
dispose();
|
||||
}
|
||||
|
||||
private void cancelActionPerformed() {
|
||||
System.out.println( "cancel" );
|
||||
dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,10 @@ OS Windows 10
|
||||
|
||||
#---- Button ----
|
||||
|
||||
Button.focusInputMap [lazy] 2 javax.swing.plaf.InputMapUIResource [UI]
|
||||
Button.focusInputMap [lazy] 4 javax.swing.plaf.InputMapUIResource [UI]
|
||||
ENTER pressed
|
||||
SPACE pressed
|
||||
released ENTER released
|
||||
released SPACE released
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user