我有以下课程
public class FileCopyManager extends JFrame{
public static final Color TRANSPARENT_COLOR = new Color(0,0,0,0);
public FileCopyManager(){
this.setBackgroundColor(TRANSPARENT_COLOR);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(()->{
try {
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
}
catch (Throwable e) {
}
finally{
new FileCopyManager();
}
});
}
}
但是当我尝试运行此程序时,我收到以下错误:
Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: The frame is decorated
at java.awt.Frame.setBackground(Unknown Source)
任何想法为什么会这样?
答案 0 :(得分:1)
好吧,只需使用this.setUndecorated(true)