java - this is my first program in GUI and it just wont open any window..no error ,nothing.I run it on commandline .what am i doing wrong? -


import java.util.; import java.awt.;

public class framo extends frame {

public framo() { setlayout(new flowlayout()); panel panel=new panel(); button btn=new button("press"); panel.add(btn); }  public static void main(string args[]) { framo f=new framo(); } 

}

you haven't added panel frame. also, need set size of frame , make frame visible.

you can refer below sample code -

    public class framo extends frame {              public framo() {                 setlayout(new flowlayout());                 panel panel = new panel();                 button btn = new button("press");                 panel.add(btn);                  add(panel);                 setsize(400, 400);                 setvisible(true);             }              public static void main(string[] args) {                 framo f = new framo();              }     } 

also, please follow java variable naming convention.


Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -