开发者

How can I customize the color of the tabbedPane at swing builder?

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开发者_StackOverflow中文版 my gui...

How can I customize the color of the tabbedPane at swing builder?

thnx in advance ^_^


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);


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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜