import java.awt.*;
import java.io.*;
public class mframe extends Frame{
Button bn,bs,be,bw,bc;
public mframe(){
super("maha");
Button bn = new Button("North");
Button bs = new Button("South");
Button be = new Button("East");
Button bw = new Button("West");
Button bc = new Button("Center");
setLayout(new FlowLayout());
//add(bn); add(bs); add(be); add(bn); add(bn);}
try{
add("North",bn);
setSize(300,300);
setVisible(true);
System.out.println("Added north and sleepling");
Thread.sleep(2000);
add("East",be);
setSize(300,300);
setVisible(true);
System.out.println("Added East and sleepling"); Thread.sleep(2000);
add("South",bn);
setSize(300,300);
setVisible(true);
System.out.println("Added South and sleepling"); Thread.sleep(2000);
add("West",bw);
setSize(300,300);
setVisible(true);
System.out.println("Added West and sleepling"); Thread.sleep(2000);
add("Center",bc);
setSize(300,300);
setVisible(true);
System.out.println("Added Center and sleepling"); Thread.sleep(2000); }
// catch(InterruptedException e) {}
}
public static void main(
String args[]){
new mframe();
} }
import java.awt.*;
import java.io.*;
public class mframe1 extends Frame{
Button bn,bs,be,bw,bc;
public mframe1(){
super("maha");
Button bn = new Button("North");
Button bs = new Button("South");
Button be = new Button("East");
Button bw = new Button("West");
Button bc = new Button("Center");
setLayout(new FlowLayout());
add(bn); add(bs); add(be); add(bn); add(bn);}
public static void main(String args[]){
new mframe1();
} }
/*
here nothing happens untill I store new mframe1() object is frame f object and call f.show().
frame f=new mframe1();
f.show();
please explain it to me.Is it due to layout as in border layout I don't have to add f.show.
*/
jaideep