2

I want to customize the color of my tabbedPane to fit at the theme of my gui, but I don't know how to do it. I've tried lots of code but still nothing happens.

Here's my gui... enter image description here

thnx in advance ^_^

Adam Crossland
  • 14,198
  • 3
  • 44
  • 54
iamanapprentice
  • 411
  • 5
  • 19
  • 37
  • are you trying to adjust the color of the tab or the inner component background (JTextArea)? – brian_d Jan 31 '11 at 16:52
  • actually that was my 2 major problem... the color of of my tab, and i want to lessen the opacity of my TextArea (i want it to be transparent) to show the image at the back(i attached the picture at the jLabel).. – iamanapprentice Feb 01 '11 at 04:26

2 Answers2

1

For the JTabbedPane look and feel, set the UIManager settings as described in this post Controlling Color in Java Tabbed Pane

Relevant code:

  UIManager.put("TabbedPane.contentAreaColor ",ColorUIResource.GREEN);
  UIManager.put("TabbedPane.selected",ColorUIResource.GREEN);
  UIManager.put("TabbedPane.background",ColorUIResource.GREEN);
  UIManager.put("TabbedPane.shadow",ColorUIResource.GREEN);

  // now construct the tabbed pane
  tab=new JTabbedPane();
Community
  • 1
  • 1
brian_d
  • 11,190
  • 5
  • 47
  • 72
1

There are couple UIManager setting you can make before you create the GUI but they will be for every JTabbedPane: This will change the selected tab color.

UIManager.put("TabbedPane.selected", Color.RED);

I don't see a setting for the border but you can hide it like so:

UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));

Lastly you can change the background of the tab pane like this:

tab.setBackground(Color.BLUE);
jzd
  • 23,473
  • 9
  • 54
  • 76