我想更改标签后面的白色背景。我试图在UIManager中设置不同的UIDefaults无济于事。我想改变tabbedpane内的面板会做到这一点,但它也没有。有谁知道怎么做?
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();
}
}
});
答案 0 :(得分:1)
这只是父组件的背景颜色。例如,如果组件直接添加到JFrame
frame.getContentPane().setBackground(Color.RED);