• Post Reply Bookmark Topic Watch Topic
  • New Topic

Colour of tabs in a JTabbedPane  RSS feed

 
Ashish Chopra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using a JTabbedPane with three tabs. However, the backgroud colour of the tabs looks a shade darker than the background colour of the pane in case of a selected tab. If I get it right, then setting the background colour of the JTabbedPane must set the same colour for the tab & the pane when selected. But this is not happening.

Please help me with the same.

TIA
 
Peter Hrycenko
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

Try too add ChangeListener to your tabbed pane, and then in stateChanged() method you must getSelectedIndex(), and set tab background color at currently selected index by the method setBacgroundAt(index,Color);

Regards.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using setBackgroundAt(tabIndex, Color)?

--
:alex |.::the_mindstorm::
 
Ashish Chopra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried using the setBackgroundAt(tabIndex, Color) with tabIndex obtained from getSelectedtabIndex().. but it does not work. The problem is that the shade of the tab colour is slightly different from the background colour of the tabbed pane.

Any other suggestions?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!