JTabbedPane & Color

G

Guest

JTabbedPane mainTab = new JTabbedPane();
.....
mainTab.setBackgroundAt(0, Color.RED);


With the code above, I set to red the background of first tab.
When tab is inactive, all right and color is red.
When tab is active, the color is not red nor light-red but light-gray.

I want when the tab is active, the tab color is red(ff0000) or
light-red (ff8080)

Can you help me please?
 
J

John McGrath

With the code above, I set to red the background of first tab.
When tab is inactive, all right and color is red.
When tab is active, the color is not red nor light-red but light-gray.

I want when the tab is active, the tab color is red(ff0000) or
light-red (ff8080)

Sorry - there is no property for controlling the background color of the
selected tab. It is controlled by the look-and-feel, normally using the
UIDefault property "TabbedPane.selected". As far as I know, the only way
to customize this would be to replace the UI delegate.
 
D

Dotty

John McGrath said:
Sorry - there is no property for controlling the background color of the
selected tab. It is controlled by the look-and-feel, normally using the
UIDefault property "TabbedPane.selected". As far as I know, the only way
to customize this would be to replace the UI delegate.

like this
UIManager.put("TabbedPane.background", Color.red);
 
J

John McGrath

like this
UIManager.put("TabbedPane.background", Color.red);

Yes, but that would affect *all* tabbed panes, which would be considered
rather unfriendly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top