Merge pull request #1406 from SiboVG/issue-1099

[#1099] Fix button grey out on macOS
This commit is contained in:
SiboVG 2022-06-04 02:01:49 +02:00 committed by GitHub
commit 23165d6288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,10 @@ public class SelectColorButton extends JButton {
if (UIManager.getColor("Button.selectForeground") == null
|| UIManager.getColor("Button.foreground") == null)
return;
// Fixes the issue of the background of the button not being blue when selected on macOS
putClientProperty("JButton.buttonType", "segmented-only");
addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {

View File

@ -64,6 +64,9 @@ public class SelectColorToggleButton extends JToggleButton {
|| UIManager.getColor("ToggleButton.foreground") == null)
return;
// Fixes the issue of the background of the button not being blue when selected on macOS
putClientProperty("JButton.buttonType", "segmented-only");
// Case: frame goes out of focus
addPropertyChangeListener("Frame.active", new PropertyChangeListener() {
@Override