Reputation: 109
Because it wont let me add an image - new account
This is utilizing the Java GUI The above image is an image pasted onto a button, I've tried to make the button transparent so that the user can't see it but I can't seem to get rid of this blue border. Code I have so far
boss2 = new JButton(); //declared the static button earlier on in the code
boss2.setSize(300, 300);
boss2.setLocation(315, 200);
boss2.setIcon(new ImageIcon("dragon.gif"));
boss2.setRolloverIcon(new ImageIcon("dragon.gif"));
boss2.setOpaque(false);
boss2.setContentAreaFilled(false);
boss2.setBorder(null);
Is there a way to get rid of the blue border surrounding my image?
edit - sorry for the earlier mishap, uploaded the wrong file
Upvotes: 1
Views: 1804
Reputation: 347194
I would suggest that what you are seeing is the focus rectangle, used to "highlight" the button as having keyboard focus.
You can use boss2.setFocusPainted(false);
to stop it from been painted.
Upvotes: 4
Reputation: 1438
To not have a boarder drawn for a JButton (assuming that you are using javax.swing.JButton) you can simply do:
boss2.setBorderPainted(false);
Upvotes: 1