Sunday, October 21, 2012

Java program to create student registration form


import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class student extends Frame implements ActionListener
{String msg;
  Button b1=new Button("save");
  Label l11=new Label("Student details",Label.CENTER);
  Label l1=new Label("Name:",Label.LEFT);
  Label l2=new Label("age:",Label.LEFT);
  Label l3=new Label("Sex(M/F):",Label.LEFT);
  Label l4=new Label("Address:",Label.LEFT);
  Label l5=new Label("Course:",Label.LEFT);
  Label l6=new Label("Semester:",Label.LEFT);
  Label l7=new Label("",Label.RIGHT);
  TextField t1=new TextField();
  Choice c1=new Choice();
  CheckboxGroup cbg=new CheckboxGroup();
  Checkbox ck1=new Checkbox("Male",false,cbg);
  Checkbox ck2=new Checkbox("Female",false,cbg);
  TextArea t2=new TextArea("",180,90,TextArea.SCROLLBARS_VERTICAL_ONLY);
  Choice course=new Choice();
  Choice sem=new Choice();
  Choice age=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(l5);
  add(l6);
  add(l7);
  add(t1);
  add(t2);
  add(ck1);
  add(ck2);
  add(course);
  add(sem);
  add(age);
  add(b1);
  b1.addActionListener(this);
  add(b1);
  course.add("BSc c.s");
  course.add("BSc maths");
  course.add("BSc physics");
  course.add("BA English");
  course.add("BCOM");
  sem.add("1");
  sem.add("2");
  sem.add("3");
  sem.add("4");
  sem.add("5");
  sem.add("6");
  age.add("17");
  age.add("18");
  age.add("19");
  age.add("20");
  age.add("21");
  l1.setBounds(25,65,90,20);
  l2.setBounds(25,90,90,20);
  l3.setBounds(25,120,90,20);
  l4.setBounds(25,185,90,20);
  l5.setBounds(25,260,90,20);
  l6.setBounds(25,290,90,20);
  l7.setBounds(25,260,90,20);
  l11.setBounds(10,40,280,20);
  t1.setBounds(120,65,170,20);
  t2.setBounds(120,185,170,60);
  ck1.setBounds(120,120,50,20);
  ck2.setBounds(170,120,60,20);
  course.setBounds(120,260,100,20);
  sem.setBounds(120,290,50,20);
  age.setBounds(120,90,50,20);
  b1.setBounds(120,350,50,30);
}
public void paint(Graphics g)
{g.drawString(msg,200,450);}
public void actionPerformed(ActionEvent ae)
{if(ae.getActionCommand().equals("save"))
  {msg="Student details saved!";
   setForeground(Color.red); }
}
public static void main(String g[])
{student stu=new student();
 stu.setSize(new Dimension(500,500));
 stu.setTitle("student registration");
 stu.setVisible(true);
}
}
 class myWindowAdapter extends WindowAdapter
{public void windowClosing(WindowEvent we)
 {
  System.exit(0);
 }
}
Output

Reactions:

34 comments:

  1. HOW DO I ADD RADIO BUTTON FOR SEM CHOICE?

    ReplyDelete
  2. what will the file name & extension?

    ReplyDelete
  3. can you explain where input data will store?

    ReplyDelete
  4. No database is included, so no storage

    ReplyDelete
  5. thankz a lot for uploading this prgm, it was very useful for my exams

    ReplyDelete
  6. and how to give the database connection to the above programm pls tell me and reply me

    ReplyDelete
  7. how to connect a database to the program????
    plsz tell

    ReplyDelete
  8. can u make this program in swing components plz!!

    ReplyDelete
  9. this prog is not working for me! why?

    ReplyDelete
  10. How Ican made Student Registration With Validation

    ReplyDelete
  11. I Need this Student Registration Form With Valodation Using Java II

    ReplyDelete
  12. please explain how can i connect it through database

    ReplyDelete
  13. i'm Beginner , How to run this code???

    ReplyDelete
  14. how to import this code to android studio

    ReplyDelete
  15. not working on my system why tel me tel me tel me tel me tel me

    ReplyDelete
  16. how can i connect to a database program and have the excel file of the registration

    ReplyDelete
  17. it this be compatible in netbeans ?

    ReplyDelete
  18. Hey i need to insert generate pdf key into this..can anyone say how to do that

    ReplyDelete
  19. i need doccumentation for this program

    ReplyDelete
  20. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete
  21. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete
  22. That is not a good programming practice, and there is no database connectivity,and also no excel sheets were added to it to store the feeded items

    ReplyDelete