0

I'm writing a Swing program using JTabbedPane (containing a JScrollPane) and the Windows look and feel. When the JTabbedPane renders with Windows L&F, it places a two pixel white line to the left, and a one pixel white line on the bottom of the Component (see attached image).

Is there a way to remove this? Adding (or removing) a border only places one around the outside of the lines. I've looked at writing my own UI for this particular component, but I'm not sure where to start exactly (let alone how to use the Windows L&F class). I can use UIManager to set the offsets to 0, but that cuts off the default border. My own theories revolve around some sort of depreciated bevel effect that doesn't render in Windows 7. Any other ideas?

TylerH
  • 20,799
  • 66
  • 75
  • 101
MobiusOne
  • 48
  • 4

1 Answers1

1

This is Look and Feel dependable. Try modifying UIManager value ofTabbedPane.contentBorderInsets.

For example:

UIManager.getDefaults().put("TabbedPane.contentBorderInsets", new Insets(1,1,1,1));

See UIManager Defaults (by @camickr) for other properties and their defaults.

EDIT:

I managed to clear the top line with TabbedPane.tabAreaInsets:

UIManager.getDefaults().put("TabbedPane.contentBorderInsets", new Insets(0,0,0,0));
UIManager.getDefaults().put("TabbedPane.tabAreaInsets", new Insets(0,0,0,0));

enter image description here

tenorsax
  • 21,123
  • 9
  • 60
  • 107
  • I tried this before; the scrollbar covers the right border, the bottom border disappeared to the bottom of the Component, and the white lines are still there. – MobiusOne Dec 09 '13 at 03:01
  • @MobiusOne please see the edit about `TabbedPane.tabAreaInsets`. – tenorsax Dec 09 '13 at 03:13
  • Try setting "TabbedPane.contentOpaque" to false, and the bevels that don't render otherwise will show. These are white otherwise, and are what are causing the issue. I can create the border by slightly changing the size of the component and changing the color of the individual colors in the bevel, but there's still clear patches showing through. [link](https://dl.dropboxusercontent.com/u/33802166/jtp-issue3.jpg) – MobiusOne Dec 09 '13 at 03:53
  • @MobiusOne sorry, I cannot reproduce that one, you should consider posting an [SSCCE](http://sscce.org/). – tenorsax Dec 09 '13 at 04:04
  • 1
    I will post one in the morning. – MobiusOne Dec 09 '13 at 04:17