I use the Nimbus L&F, and I'm trying to remove the border shown on the picture below, as well as centering the tabs on my screen, similar to the default Mac OS look and feel. But I have still not had any success.
Help anyone?
Not sure why you would even want to do this, but what you want to do is modify the defaults. You can see Nimbus Defaults for all of the default settings. If you scroll down the page, you will see all the defaults for TabbedPanes.
You can see all the painting of these default properties are done by a Painter
. You can set the painter to null, so it won't paint anything.
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
UIManager.getLookAndFeelDefaults().put(
"TabbedPane:TabbedPaneTabArea[Disabled].backgroundPainter", null);
UIManager.getLookAndFeelDefaults().put(
"TabbedPane:TabbedPaneTabArea[Enabled+MouseOver].backgroundPainter", null);
UIManager.getLookAndFeelDefaults().put(
"TabbedPane:TabbedPaneTabArea[Enabled+Pressed].backgroundPainter", null);
UIManager.getLookAndFeelDefaults().put(
"TabbedPane:TabbedPaneTabArea[Enabled].backgroundPainter", null);
break;
}
}