java - after compilling code JFrame does not appear -
i'm using intelij idea platform.
i have following code:
package gui.test; import javax.swing.*; public class ramka extends jframe{ ramka(){ setvisible(true); setsize(100,100); } public void main (string[] args){ new ramka(); } }
i expected see jframe after compiling code, nothing appeared. kind of problem can be?
also must admit, haven't possibility run method "main". inteligidea propose me compile ramka.java. after compilling intelijideay says, compilation complited sucessfully, thats , nothing happened. in previous exersises allways ran method "main".
you should this:
public static void main (string[] args){ java.awt.eventqueue.invokelater(new runnable() { public void run() { new ramka().setvisible(true); } }); }
besides missing static
identifier @ main
, have make sure frame runs in right thread check "concurrency" swing
Comments
Post a Comment