Import Javax.swing.JComboBox;
Import Javax.swing.JFrame;
Import Javax.swing.JLabel;
Import Javax.swing.JTextField;
Class Winbox extends jframe{
JLabel Xm,xb,zy;
JTextField TF1,TF2;
JComboBox Jbox;
Public Winbox () {
Init ();
SetLayout (NULL);
SetVisible (TRUE);
Setdefaultcloseoperation (Jframe.exit_on_close);
}
void Init () {
Xm=new JLabel ("Name:");
Add (XM);
SetBounds (30, 30, 38,30);
Xb=new JLabel ("Gender:");
Add (XB);
SetBounds (30, 70, 38, 30);
Zy=new JLabel ("Occupation:");
Add (Zy);
SetBounds (30, 110, 38, 30);
Tf1=new JTextField (30);
Add (TF1);
SetBounds (88, 30, 38, 30);
Jbox=new JComboBox ();
Jbox.additem ("male");
Jbox.additem ("female");
Add (Jbox);
SetBounds (88, 70, 38, 30);
Tf2=new JTextField (30);
Add (TF2);
SetBounds (88, 110, 38, 30);
}
}
public class Nulllayoutdemo {
public static void Main (string[] args) {
TODO auto-generated Method Stub
Winbox win=new Winbox ();
Win.setbounds (100,100,380,280);
Win.settitle ("box-nested Layout");
}
}
On-line kneel beg Ah!!!
Why can't the layout be displayed with NULL