使用Sea-Glass Look and Feel更改为JFrame背景的正确方法是什么,到目前为止,我尝试了两种方法:
frame.getContentPane().setBackground(Color.blue);
和
JPanel x = new JPanel();
x.setBackground(Color.red);
frame.setContentPane(x);
但它没有产生任何影响:
import javax.swing.*;
import com.seaglasslookandfeel.*;
import java.awt.*;
import java.awt.Color.*;
public class BORDER_TEST {
public static void main(String[] a){
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
JFrame frame = new JFrame();
JPanel x = new JPanel();
x.setBackground(Color.red);
frame.setContentPane(x);
//frame.getContentPane().setBackground(Color.blue);
frame.setPreferredSize(new Dimension(900,350));
frame.setAlwaysOnTop(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}