JTabbedPane active tab setting do not work (except FG color)

Hi,

I have a JTabbedPane panel.  I have very little control of an active tab display.  The only thing I can do with it is to set a foreground (label) color.  If I set an active tab background color or set label font size or style - it does not work.  

I cannot believe that these methods do not work.

Thanks.
akoifmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
UIDefaults.put("TabbedPane.background", Color.white);
UIDefaults.put("TabbedPane.focus", Color.red);
0
Mick BarryJava DeveloperCommented:
before creating your tab pane set the selected tab background using:

UIDefaults.put("TabbedPane.selected", Color.yellow);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
akoifmanAuthor Commented:
Can I control tab font size, style?
0
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

CEHJCommented:
UIDefaults.put("TabbedPane.font", someFont);
0
Mick BarryJava DeveloperCommented:

you can change the font used using

tabs.setFont(font);

But you cannoty change the font just for the selected tab.
0
akoifmanAuthor Commented:
Hi Objects,

I am almost there.  

I have a two-row hierarchical tabs.  Can I set an active tab BG in top row different from an active tab BG in the lower row?  Thanks!
0
akoifmanAuthor Commented:
This makes all selected tabs the same color:
UIDefaults.put("TabbedPane.selected", Color.yellow);
 
0
Mick BarryJava DeveloperCommented:
yes, change the UIdefault between the creation of the two tabs

0
CEHJCommented:
I wonder why my comments were ignored - especially since it was the *background* you were asking about?
0
akoifmanAuthor Commented:
Hi CEHJ,

Both you and OBJECT provided the solution.  This did not work for me UIDefaults.put("TabbedPane.focus", Color.red);

I had a few follow up questions, and I felt that OBJECT helped me with those.  I wish I can give you some extra points.  If this can be done, I'll give you 100 points.

Thank you!
0
CEHJCommented:
>>Both you and OBJECT provided the solution.

Yes, that's precisely my point

>> This did not work for me UIDefaults.put("TabbedPane.focus", Color.red);

That's not the part that deals with the background though
0
Mick BarryJava DeveloperCommented:
question seemed quite clearly about the *active* tab background was it not, the tab background itself can be easily changed without worrying about UIDefaults.
0
akoifmanAuthor Commented:
I think Object is correct.  He provide the answer:
UIDefaults.put("TabbedPane.selected", Color.yellow);

Cehj, thanks a lot for your effort.
0
CEHJCommented:
>>Cehj, thanks a lot for your effort.

No problem - i see you've put my code to use in your next question
0
akoifmanAuthor Commented:
Yes, I learened something and find it more convinient than setBackground().  THANKS!
0
Mick BarryJava DeveloperCommented:
> Yes, I learened something and find it more convinient than setBackground().  THANKS!

user beware, they are not the same thing :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.