2016-09-24 2 views
0

J'ai complètement transparent la classe suivanteCréer un JFrame

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(); 
      } 
     }); 
    } 
} 

Cependant, lorsque je tente d'exécuter ce programme, je reçois l'erreur suivante:

Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: The frame is decorated 
    at java.awt.Frame.setBackground(Unknown Source) 

Toutes les idées pourquoi cela se passe?

Répondre

1

Eh bien, utilisez simplement this.setUndecorated(true)