[#1099] Fix button grey out on macOS

This commit is contained in:
SiboVG 2022-06-04 01:56:33 +02:00
parent 3148a25217
commit e516ddb223
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