2014-09-27 87 views
0

我想更改标签后面的白色背景。我试图在UIManager中设置不同的UIDefaults无效。我认为改变tabbedpane内的面板会做到这一点,但它也没有。有谁知道如何?Nimbus外观和感觉JTabbedPane标签背景颜色

EventQueue.invokeLater(new Runnable() { 
     public void run() { 
      try { 
       UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); 
       UIDefaults defaults = UIManager.getLookAndFeelDefaults(); 
       defaults.put("Table.gridColor", new Color (214,217,223)); 
       defaults.put("Table.selectionBackground", new Color(250,235,215)); 
       defaults.put("Table.selectionForeground", Color.BLACK); 
       defaults.put("TabbedPane.background", new Color(175, 238, 238)); 

       MainWindow frame = new MainWindow(); 
      } catch (Exception e) { 
       e.printStackTrace(); 
      } 
     } 
    }); 

Modify the White Background behind the Row of Tabs

回答

1

这将简单地是父组件的背景色。例如,如果组件被直接添加到JFrame

frame.getContentPane().setBackground(Color.RED); 
+0

好主意是选项卡面板围成一个面板,该面板提供背景,并使其不透明。问题是Nimbus L&F延长了Synth L&F,因此很难重新定制。 – 2014-09-28 11:39:29