Merge pull request #1856 from SiboVG/issue-1851
[#1851] Reset button foreground on focus loss
This commit is contained in:
commit
462e264697
@ -8,6 +8,8 @@ import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
|
||||
public class SelectColorButton extends JButton {
|
||||
public SelectColorButton() {
|
||||
@ -53,5 +55,13 @@ public class SelectColorButton extends JButton {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Need to add this, otherwise the foreground can remain in the selectForeground state when the button is clicked
|
||||
addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
setForeground(UIManager.getColor("Button.foreground"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user