I create some buttons with only their image visible:
public static JButton createImageButton(ImageIcon image) {
JButton btn = new JButton(image);
btn.setContentAreaFilled(false);
btn.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return btn;
}
This gives me the following output:
While pressing the button I usually get:
But when I change the LaF to Nimbus, this won't happen.
Is there any possibility to configure Nimbus to darken the icon while pressing a button ?
I've already tried to change some of the button defaults like this:
UIManager.getLookAndFeelDefaults()
.put("Button[Pressed].backgroundPainter", new CustomPainter());
But I'm not sure how to write a CustomPainter
class or if this solves the problem at all...