I set the icon of my button to an .png I made in photoshop, but instead of just the image being visible, then there's still the button border or what ever you wish to call it.
I want the button to just be:
there are set of methods implemented in API that created undecorated JButton, e.g.
JButton button = new JButton();
button.setBorderPainted(false);
button.setBorder(null);
//button.setFocusable(false);
button.setMargin(new Insets(0, 0, 0, 0));
button.setContentAreaFilled(false);
button.setIcon(myIcon1);
button.setRolloverIcon(myIcon2);
button.setPressedIcon(myIcon3);
button.setDisabledIcon(myIcon4);
You just missed a line.
i.e. btn.setBorder(null);
is the only thing you need to do. Rest is perfect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With