Java Programs Booklet
Java Programs Booklet
*; public class student extends Frame implements ActionListener { String msg; Label l11=new Label("STUDENT REGISTRATION FORM",Label.CENTER); Label l1=new Label("First Name:",Label.LEFT); Label l2=new Label("Last Name:",Label.LEFT); Label l3=new Label("Gender(M/F):",Label.LEFT); Label l4=new Label("Branch:",Label.LEFT); Button b1=new Button("submit"); TextField t1=new TextField(); TextField t2=new TextField(); Choice c1=new Choice(); CheckboxGroup cbg=new CheckboxGroup(); Checkbox ck1=new Checkbox("Male",false,cbg); Checkbox ck2=new Checkbox("Female",false,cbg); Choice Branch=new Choice(); public student() { addWindowListener(new myWindowAdapter()); setBackground(Color.cyan); setForeground(Color.black); setLayout(null); add(l11); add(l1); add(l2); add(l3); add(l4); add(t1); add(t2); add(ck1); add(ck2); add(Branch); add(b1); b1.addActionListener(this); add(b1); Branch.add("c.s"); Branch.add("ece"); Branch.add("me"); l11.setBounds(10,40,280,20); l1.setBounds(25,65,90,20); l2.setBounds(25,90,90,20); l3.setBounds(25,120,90,20); l4.setBounds(25,185,90,20);
g.drawString(msg,200,450);} public void actionPerformed(ActionEvent ae) { if(ae.getActionCommand().equals("save")) { setForeground(Color.red); } } public static void main(String args[]) { student stu=new student(); stu.setSize(new Dimension(400,400)); stu.setTitle("student registration"); stu.setVisible(true); } } class myWindowAdapter extends WindowAdapter {public void windowClosing(WindowEvent we) { System.exit(0); } }