Reputation: 783
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?
Upvotes: 1
Views: 806
Reputation: 1572
This removed those borders for me, what i wanted was to change it style but whatever...
tabbedPane.setUI(new javax.swing.plaf.basic.BasicTabbedPaneUI() {
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) {};
});
Upvotes: 0
Reputation: 209132
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;
}
}
Upvotes: 1