mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 06:50:56 +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:
@@ -12,6 +12,8 @@ FlatLaf Change Log
|
|||||||
- TabbedPane: Support background color for selected tabs.
|
- TabbedPane: Support background color for selected tabs.
|
||||||
- CheckBox: changed `CheckBox.arc` from radius to diameter to be consistent with
|
- CheckBox: changed `CheckBox.arc` from radius to diameter to be consistent with
|
||||||
`Button.arc` and `Component.arc`
|
`Button.arc` and `Component.arc`
|
||||||
|
- Button: Enabled `Button.defaultButtonFollowsFocus` on Windows, which allows
|
||||||
|
pressing focused button with <kbd>Enter</kbd> key (as in Windows LaF).
|
||||||
- Fixed clipped borders at 125%, 150% and 175% scaling when outer focus width is
|
- Fixed clipped borders at 125%, 150% and 175% scaling when outer focus width is
|
||||||
zero (default in "Flat Light" and "Flat Dark" themes).
|
zero (default in "Flat Light" and "Flat Dark" themes).
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ Button.margin=2,14,2,14
|
|||||||
Button.iconTextGap=4
|
Button.iconTextGap=4
|
||||||
Button.rollover=true
|
Button.rollover=true
|
||||||
Button.defaultButtonFollowsFocus=false
|
Button.defaultButtonFollowsFocus=false
|
||||||
|
[win]Button.defaultButtonFollowsFocus=true
|
||||||
|
|
||||||
Button.default.borderWidth=1
|
Button.default.borderWidth=1
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ class ControlBar
|
|||||||
EventQueue.invokeLater( () -> {
|
EventQueue.invokeLater( () -> {
|
||||||
// update info label because user scale factor may change
|
// update info label because user scale factor may change
|
||||||
updateInfoLabel();
|
updateInfoLabel();
|
||||||
|
|
||||||
|
// this is necessary because embedded JOptionPane's "steal" the default button
|
||||||
|
frame.getRootPane().setDefaultButton( closeButton );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -143,6 +143,9 @@ public class FlatTestFrame
|
|||||||
KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0, false ),
|
KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0, false ),
|
||||||
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
|
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
|
||||||
|
|
||||||
|
// make the "close" button the default button
|
||||||
|
getRootPane().setDefaultButton( closeButton );
|
||||||
|
|
||||||
// close frame
|
// close frame
|
||||||
closeButton.addActionListener(e -> dispose());
|
closeButton.addActionListener(e -> dispose());
|
||||||
|
|
||||||
@@ -170,6 +173,9 @@ public class FlatTestFrame
|
|||||||
|
|
||||||
// enable/disable scale factor combobox
|
// enable/disable scale factor combobox
|
||||||
updateScaleFactorComboBox();
|
updateScaleFactorComboBox();
|
||||||
|
|
||||||
|
// this is necessary because embedded JOptionPane's "steal" the default button
|
||||||
|
getRootPane().setDefaultButton( closeButton );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|||||||
Reference in New Issue
Block a user