Default Highlight Borders
I am trying to remove the default highlighting that occurs on objects. When I add a JTabbedPane, JButton, or any other object to my application, a border is created on the outside edges. I am hoping to stop them from appearing, maybe by setting the colors to match my interface. Any help would be greatly appreciated!!
Yes, the setBorder(null); is not solving my problem. I am talking about the very edge of the component. The top/left sides get a light highlight and the right/bottom sides get a dark one. I am trying to remove that outer edge line, keep it from being drawn, or make it the same color as my application to "hide" it.
http://www.instaprint.com/images/borderhelp.gifHere is an image of what I am speaking about. I have tried the setBorder(null); on the JTabbedPane, JPanel, JTable, JScrollBar, ect. It all compiles but the border remains?
Yeah, I see what u mean.
The left-hand side has been set to a BevelBorder.RAISED
and the right hand side set to BevelBorder.LOWERED.
Just look for the component to which you are adding the JTable..say x..
Either remove the border or set an empty border like this...
x.setBorder(new EmptyBorder(5,5,5,5));
Similarly look for the component to which you are adding the tabbed pane.
And repeat the same.
Oh, in case you are inheriting from another custom-class just make sure you
aren't specifying the border behaviour in that class. Know what i mean ?
All the best.
For the other objects like the JTabbedPane, you may have to do something sort of involved like override certain paint methods in the BasicTabbedPaneUI class. Specifically, you may want to override the paintContentBorder method (make it do nothing).
http://java.sun.com/j2se/1.3/docs/api/javax/swing/plaf/basic/BasicTabbedPaneUI.html
This technique should work if setBorder(null) doesn't work.