mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +03:00
Button: enabled Button.defaultButtonFollowsFocus on Windows, which allows pressing focused button with <kbd>Enter</kbd> key (as in Windows LaF)
This commit is contained in:
@@ -143,6 +143,9 @@ public class FlatTestFrame
|
||||
KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0, false ),
|
||||
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
|
||||
|
||||
// make the "close" button the default button
|
||||
getRootPane().setDefaultButton( closeButton );
|
||||
|
||||
// close frame
|
||||
closeButton.addActionListener(e -> dispose());
|
||||
|
||||
@@ -170,6 +173,9 @@ public class FlatTestFrame
|
||||
|
||||
// enable/disable scale factor combobox
|
||||
updateScaleFactorComboBox();
|
||||
|
||||
// this is necessary because embedded JOptionPane's "steal" the default button
|
||||
getRootPane().setDefaultButton( closeButton );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user