如何在swing构建器中自定义tabbedPane的颜色?

我想自定义我的tabbedPane的颜色以适应我的gui的主题,但我不知道该怎么做。我尝试了很多代码,但仍然没有任何反应。 这是我的gui ...... thnx提前^ _ ^     
已邀请:
在创建GUI之前,您可以设置几个UIManager设置,但它们适用于每个JTabbedPane: 这将更改选定的选项卡颜色。
UIManager.put("TabbedPane.selected", Color.RED);
我没有看到边框的设置,但你可以像这样隐藏它:
UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));
最后,您可以更改选项卡窗格的背景,如下所示:
tab.setBackground(Color.BLUE);
    
对于JTabbedPane外观,请按照以下文章中的描述设置
UIManager
设置在Java Tabbed Pane中控制颜色 相关代码:
  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();
    

要回复问题请先登录注册