I am haviong the following code which is compiling fine but on running the
applet, nothing except a Frame comes. Can you tell me why other components are not displayed and "System.out.println" have not printed.
I am new to
java pl help me
code:
import java.awt.*;
import java.applet.Applet;
public class test1 extends Applet{
public void init(){
System.out.println("the size is x = "+this.getSize().width+" and y = "+this.getSize().height);
this.setForeground(Color.blue);
this.setBackground(Color.green);
this.setFont(new Font("serif",Font.BOLD,15));
Button b= new Button("press me");
Canvas c = new Canvas();
CheckboxGroup cbg = new CheckboxGroup();
Checkbox ab1 = new Checkbox("just check this",true,cbg);
Checkbox ab2 = new Checkbox("just check that",true,cbg);
Checkbox ab3 = new Checkbox("just check there",true,cbg);
Choice c1= new Choice();
c1.add("this this my choice");
c1.add("this this your choice");
Label l = new Label("this is label",Label.CENTER);
List Li = new List(4,true);
Li.add("this is 1");
Li.add("this is 2");
Li.add("this new 1");
ScrollPane sp= new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
Label lb = new Label("scrollpane is my owner");
lb.setFont(new Font("monospaced",Font.PLAIN,15));
sp.add(lb);
sp.setSize(50,50);
Scrollbar sc = new Scrollbar(Scrollbar.VERTICAL,25,25,0,100);
TextField tf = new TextField("my name is shikhar",15);
Frame f = new Frame("FRAME");
f.setSize(500,500);
f.setVisible(true);
FileDialog fg = new FileDialog(f,"this is to select",FileDialog.SAVE);
System.out.println("the item fron list is "+Li.getItem(2));
add(b);
add(c);
add(ab1);
add(ab2);
add(ab3);
add(c1);
add(l);
add(Li);
add(sp);
add(sc);
add(tf);
add(f);
}
}
thanks in advance