student application form Java Netbeans

7,723 views

Published on

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,723
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
336
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

student application form Java Netbeans

  1. 1. STUDENTAPPLICATION FORM RESHMA JOHNEY ROLL NO:24 Submitted to MISS Divya James Submitted on 1-11-2010
  2. 2. STUDENT APPLICATON FORM RESHMA JOHNEY Second year, Rajagiri School of Engineering and Technology KAKANAD, ERNAKULAM reshmajohney@yahoo.com “STUDENT APPLICATION FORM” aims at developing student application formwhere we can easily store the details of a new student and retrieve the details of studentthereby. When a student comes, we can enter the details of the student in the studentapplication form and can easily update the details of the student when required. In thisassignment, an additional facility is given where we can delete the details of a studentwhen a need arises. The assignment is very useful and proper validation is given for eachfield and hopes that the computerization of the Student Application Form will not onlyimproves the efficiency but will also reduce human stress thereby indirectly improvinghuman recourses.
  3. 3. INDEX Sl.No: TOPICS Page_no: 1 Problem definition 3 2 Theoretical Background 3-4 3 Table Design 6-7 4 Program code 8-44 5 Result 44-49 6 Conclusion 50 I. PROBLEM DEFINTION The Student Application form is designed & developed for the proper entry and updationof student’s details. The Student details are entered in Student Entry form and thesecorresponding student details are entered to a database using ODBC connectivity. When astudent wishes to update the details, he can update the details using an updating form. Andthe updated details will be also updated to the database. There is another option is given inwhich student can delete his account and these changes will directly reflect in the database. i. II. THEORETICAL BACKGROUNDThe entire code is done with java swing controls. Swing, which is an extension libraryto the AWT, includes new and improved components that enhance the look andfunctionality of GUIs. Swing can be used to build Standalone swing GUIs Apps. Itemploys model/view design architecture. Swing is more portable and more flexible thanAWT. Swing is built on top of AWT and is entirely written in Java, using AWT’slightweight component support. In particular, unlike AWT, the architectureof Swing components makes it easy to customize both their appearance and behavior.Components from AWT and Swing can be mixed, allowing you to add Swing supportto existing AWT-based programs. For example, swing components such as JSlider,JButton and JCheckbox could be used in the same program with standard AWT labels,textfields and scrollbars. You could subclass the existingSwing UI, model, or changelistener classes without having to reinvent the entire implementation. Swing also has theability to replace these objects on-the-fly.
  4. 4. Form is designed for selection of the different Menus. Following forms are mainlyused:- 1. Application Form 2 Updating Form a) Update b) Deletion And the form design is a follows… STUDENT ENTRY FORM As said earlier, the student application form has the following options ‘SUBMIT’, ‘UPDATE’, ‘RESET’, ‘EXIT’.
  5. 5. UPDATION FORMBy clicking the menu ‘UPDATE, the form will direct in to another form named“UPDATON FORM” and this form can used as a means for updating the studentdetails if required.By clicking the ‘UPDATE’ Menu of the first form (student application form) theabove form will be displayed for the updating facility. Following fields have beenprovided for the entry of the updated information:-
  6. 6. 1. ID.2. NAME.3. COURSE. (Where we cannot change the value of ID, NAME, AND COURSE).4. AGE.5. BRANCH.6. COUNTRY.7. PLACE.8. E-mail ID.9. DATE OF BIRTH. (cannot change the value) In addition, clear, delete user, update, exit buttons and a combo box is also providedin order to select the student name from database have been provided in the form. BOOK DELETEBy clicking the Delete Menu of the updating form, the selected user account and hisdetails will be deleted from the database using the query:String d="DELETE from student where NAME="+combo.getSelectedItem () +""; Table Design Every form is linked to a database (Microsoft Access 2010) form. And table design for form is given as follows. student FIELD NAME DATATYPE ID AuoNumber NAME Text AGE Number DATE_OF_BIRTH Number BRANCH Text COUNTRY Text PLACE Text
  7. 7. EMAIL TextCOURCE TextThe database is given below..
  8. 8. PROGRAM CODEPROGRAM CODE FOR STUDENT APPLICATION FORMCODE:/* * NewJFrame.java(the name of my java file which is used to enter the details of student * * Created on October 13, 2010, 8:59 AM *///package student_application_form;import java.sql.*;/** * * @author RESHMA */public class NewJFrame extends javax.swing.JFrame { /** Creates new form NewJFrame */ public NewJFrame() { initComponents(); load_date(); load_cource(); } public void load_cource() { course_combo .addItem("B Tech"); course_combo.addItem("M Tech"); course_combo.addItem("MCA"); } public void load_date() { int i; for( i=1;i<=31;i++){ date_combo.addItem(i); }for( i=1;i<=12;i++){month_combo.addItem(i);}for( i=1980;i<=2010;i++){year_combo.addItem(i);}
  9. 9. }/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */// <editor-fold defaultstate="collapsed" desc="Generated Code">private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); buttonGroup2 = new javax.swing.ButtonGroup(); label1 = new java.awt.Label(); label2 = new java.awt.Label(); NAME = new java.awt.TextField(); label3 = new java.awt.Label(); AGE = new java.awt.TextField(); label4 = new java.awt.Label(); BRANCH = new java.awt.TextField(); label5 = new java.awt.Label(); COUNTRY = new java.awt.TextField(); label6 = new java.awt.Label(); PLACE = new java.awt.TextField(); label7 = new java.awt.Label(); EMAIL = new java.awt.TextField(); RESET = new javax.swing.JButton(); submit = new javax.swing.JButton(); EXIT = new javax.swing.JButton(); Success = new java.awt.Label(); Label8 = new java.awt.Label(); ID = new java.awt.TextField(); UPDATE = new javax.swing.JToggleButton(); age_status = new java.awt.Label(); jLabel1 = new javax.swing.JLabel(); name_status = new java.awt.Label(); jLabel2 = new javax.swing.JLabel(); status1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); month_combo = new javax.swing.JComboBox(); date_combo = new javax.swing.JComboBox(); year_combo = new javax.swing.JComboBox(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); course_combo = new javax.swing.JComboBox();
  10. 10. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);setBackground(new java.awt.Color(102, 255, 255));setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));setForeground(new java.awt.Color(204, 51, 255));label1.setAlignment(java.awt.Label.CENTER);label1.setBackground(new java.awt.Color(255, 102, 153));label1.setForeground(new java.awt.Color(51, 255, 51));label1.setText("STUDENT ENTRY FORM");label1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { label1MouseClicked(evt); }});label1.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentHidden(java.awt.event.ComponentEvent evt) { label1ComponentHidden(evt); }});label1.addHierarchyListener(new java.awt.event.HierarchyListener() { public void hierarchyChanged(java.awt.event.HierarchyEvent evt) { label1HierarchyChanged(evt); }});label2.setText("NAME :");NAME.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { NAMEActionPerformed(evt); }});NAME.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { NAMEFocusLost(evt); }});label3.setText(" AGE :");AGE.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { AGEFocusLost(evt); }});
  11. 11. label4.setText("BRANCH:"); BRANCH.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { BRANCHFocusLost(evt); } }); label5.setText("COUNTRY"); COUNTRY.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { COUNTRYActionPerformed(evt); } }); COUNTRY.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { COUNTRYFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { COUNTRYFocusLost(evt); } }); label6.setText("PLACE"); label7.setText("E-mail ID"); RESET.setBackground(new java.awt.Color(255, 51, 255)); RESET.setForeground(new java.awt.Color(51, 255, 51)); RESET.setText("RESET"); RESET.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RESETActionPerformed(evt); } }); submit.setBackground(new java.awt.Color(255, 51, 255)); submit.setForeground(new java.awt.Color(51, 255, 51)); submit.setText("SUBMIT"); submit.setBorder(javax.swing.BorderFactory.createLineBorder(newjava.awt.Color(255, 51, 51))); submit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { submitActionPerformed(evt);
  12. 12. }});submit.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { submitFocusGained(evt); }});EXIT.setBackground(new java.awt.Color(255, 0, 255));EXIT.setForeground(new java.awt.Color(51, 255, 51));EXIT.setText("EXIT");EXIT.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EXITActionPerformed(evt); }});Label8.setText("ID");ID.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { IDActionPerformed(evt); }});ID.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { IDFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { IDFocusLost(evt); }});UPDATE.setBackground(new java.awt.Color(255, 0, 255));UPDATE.setForeground(new java.awt.Color(102, 255, 51));UPDATE.setText("UPDATE");UPDATE.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UPDATEActionPerformed(evt); }});status1.setBackground(new java.awt.Color(51, 0, 204));status1.setFont(new java.awt.Font("Traditional Arabic", 0, 36));status1.setForeground(new java.awt.Color(51, 0, 51));
  13. 13. jLabel3.setText("DOB:"); jLabel4.setText("D"); jLabel5.setText("M"); jLabel6.setText("Y"); jLabel7.setText("COURSE"); course_combo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { course_comboActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel1) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(8, 8, 8) .addComponent(jLabel3)) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(Label8,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(label5,javax.swing.GroupLayout.PREFERRED_SIZE, 84,javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  14. 14. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(AGE,javax.swing.GroupLayout.PREFERRED_SIZE, 32,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ID,javax.swing.GroupLayout.PREFERRED_SIZE, 34,javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(age_status,javax.swing.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) .addGroup(layout.createSequentialGroup().addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(PLACE,javax.swing.GroupLayout.PREFERRED_SIZE, 156,javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4,javax.swing.GroupLayout.PREFERRED_SIZE, 7,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(date_combo,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel5).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(month_combo,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  15. 15. .addComponent(jLabel6).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(year_combo,javax.swing.GroupLayout.PREFERRED_SIZE, 61,javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(12, 12, 12)))) .addGroup(layout.createSequentialGroup() .addComponent(label3,javax.swing.GroupLayout.PREFERRED_SIZE, 60,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING,layout.createSequentialGroup() .addGap(116, 116, 116) .addComponent(jLabel2)) .addGroup(layout.createSequentialGroup() .addGap(144, 144, 144).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 250,Short.MAX_VALUE) .addComponent(name_status,javax.swing.GroupLayout.PREFERRED_SIZE, 53,javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,false) .addComponent(COUNTRY,javax.swing.GroupLayout.Alignment.LEADING,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(NAME,javax.swing.GroupLayout.Alignment.LEADING,javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE))
  16. 16. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,false) .addComponent(BRANCH,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(EMAIL,javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE) .addComponent(course_combo,javax.swing.GroupLayout.Alignment.LEADING,javax.swing.GroupLayout.PREFERRED_SIZE, 95,javax.swing.GroupLayout.PREFERRED_SIZE)))))) .addGroup(layout.createSequentialGroup() .addGap(51, 51, 51).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(label7,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(label2,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(label6,javax.swing.GroupLayout.PREFERRED_SIZE, 70,javax.swing.GroupLayout.PREFERRED_SIZE).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,false) .addComponent(label4,javax.swing.GroupLayout.Alignment.LEADING,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(jLabel7,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 326,Short.MAX_VALUE))) .addGap(68, 68, 68))) .addGap(591, 591, 591)) .addGroup(layout.createSequentialGroup() .addGap(158, 158, 158) .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, 334,javax.swing.GroupLayout.PREFERRED_SIZE)
  17. 17. .addContainerGap(894, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(201, 201, 201) .addComponent(EXIT, javax.swing.GroupLayout.PREFERRED_SIZE, 78,javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(submit, javax.swing.GroupLayout.PREFERRED_SIZE, 98,javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(RESET)) .addGroup(layout.createSequentialGroup() .addGap(208, 208, 208).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(Success, javax.swing.GroupLayout.PREFERRED_SIZE,243, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(UPDATE,javax.swing.GroupLayout.PREFERRED_SIZE, 217,javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(910, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGap(172, 172, 172) .addComponent(status1, javax.swing.GroupLayout.PREFERRED_SIZE, 445,javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(769, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(28, 28, 28) .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, 33,javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(25, 25, 25) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(name_status, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addGap(24, 24, 24)
  18. 18. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(NAME, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup() .addComponent(COUNTRY,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18,Short.MAX_VALUE) .addComponent(EMAIL,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup() .addComponent(label6,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18,Short.MAX_VALUE) .addComponent(label7,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,false)
  19. 19. .addComponent(age_status,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(label3, javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(AGE, javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(PLACE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(label5,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(13, 13, 13)) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ID, javax.swing.GroupLayout.Alignment.TRAILING,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Label8,javax.swing.GroupLayout.Alignment.TRAILING,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(30, 30, 30))) .addGap(10, 10, 10).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jLabel4) .addComponent(date_combo,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5) .addComponent(month_combo,javax.swing.GroupLayout.PREFERRED_SIZE,
  20. 20. javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6) .addComponent(year_combo,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(BRANCH, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(course_combo,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7)) .addGap(37, 37, 37).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(submit, javax.swing.GroupLayout.PREFERRED_SIZE, 26,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(RESET) .addComponent(EXIT)) .addGap(18, 18, 18) .addComponent(UPDATE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(Success, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(55, 55, 55) .addComponent(status1, javax.swing.GroupLayout.PREFERRED_SIZE, 43,javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(342, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void NAMEActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: }
  21. 21. private void RESETActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: ID.setText(""); NAME.setText(""); AGE.setText(""); BRANCH.setText(""); COUNTRY.setText(""); PLACE.setText(""); EMAIL.setText(""); Success.setText(""); age_status.setText(""); status1.setText(""); } private void submitActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: javax.swing.JOptionPane.showMessageDialog(null, "CHECK ALL FIELDS ONCEAGAIN BEFORE LOGIN "); try{ String aa=""; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url="jdbc:odbc:student"; Connection con=DriverManager.getConnection(url); Statement stmt=con.createStatement(); String new_user=""; String user=NAME.getText().trim(); ResultSet rs=stmt.executeQuery("select * from student whereID="+ID.getText()+""); while(rs.next()) { aa=rs.getString("ID"); } if((ID.getText().equals(""))){ Success.setText("Invalid Please provide a ID!"); } else if((ID.getText().equals(aa))){ Success.setText("ID Already exists"); } else{ String s="Insert intostudent(ID,NAME,AGE,BRANCH,COUNTRY,PLACE,EMAIL,COURSE,DATE_,OF,BI
  22. 22. RTH)values("+ID.getText()+","+NAME.getText()+","+AGE.getText()+","+BRANCH.getText()+","+COUNTRY.getText()+","+PLACE.getText()+","+EMAIL.getText()+","+course_combo.getSelectedItem()+","+date_combo.getSelectedItem()+","+month_combo.getSelectedItem()+","+year_combo.getSelectedItem()+")"; stmt.executeUpdate(s); Success.setText("SuccessFully Inserted....!"); //Success.setText("New User added"); javax.swing.JOptionPane.showMessageDialog(null, "NEW USERADDED!..........."); } stmt.close(); } catch(Exception e) { Success.setText("Error in Loading.....!"); } } private void EXITActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: System.exit(0); } private void IDActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void UPDATEActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: dispose(); new s().setVisible(true);} private void AGEFocusLost(java.awt.event.FocusEvent evt) {
  23. 23. // TODO add your handling code here: try { String check_age; int m; check_age=AGE.getText(); if(check_age.equals("")) { Success.setText(""); } else { m=Integer.parseInt(AGE.getText()); if(m>30) { javax.swing.JOptionPane.showMessageDialog(null, "STUDENTS CANT HAVEAN AGE ABOVE 30"); age_status.setText("INVALID"); AGE.setText(""); }else if (m< 1) { javax.swing.JOptionPane.showMessageDialog(null, "ENTER AGE PROPER .."); AGE.setText(""); age_status.setText("INVALID"); }else { age_status.setText(""); } } } catch(NumberFormatException e) { Success.setText("AGE SHOULD BE AN INTEGER!!!!" );
  24. 24. } catch(Exception e) { age_status.setText("INVALID"); } } private void IDFocusLost(java.awt.event.FocusEvent evt) { // TODO add your handling code here: try{ String id=""; if(ID.getText().equals("")) { Success.setText(""); } else{ id=ID.getText(); int a=Integer.parseInt(id); // javax.swing.JOptionPane.showMessageDialog(null, "U CHOOSEN"+ID.getText()+" "); } } catch(NumberFormatException e) { javax.swing.JOptionPane.showMessageDialog(null, "ID SHOULD BE ANINTEGER!!!!" ); ID.setText(""); } } private void BRANCHFocusLost(java.awt.event.FocusEvent evt) { // TODO add your handling code here: String brh=""; brh=BRANCH.getText(); if(brh.equals("")) { Success.setText("CHOOSE A BRANCH");
  25. 25. } else{ //int a; // a=Integer.parseInt(brh); javax.swing.JOptionPane.showMessageDialog(null, "U CHOOSEN"+BRANCH.getText()+" BRANCH"); } } private void submitFocusGained(java.awt.event.FocusEvent evt) { // TODO add your handling code here: // javax.swing.JOptionPane.showMessageDialog(null, "CHECK ALL FIELDSONCE AGAIN BEFORE LOGIN "); // dispose(); } private void NAMEFocusLost(java.awt.event.FocusEvent evt) { // TODO add your handling code here: status1.setText("WELCOME "+NAME.getText()+"!!!!!!!!!!");/* String name_check; name_check=NAME.getText(); if(name_check<99999&&name_check>1) { javax.swing.JOptionPane.showMessageDialog(null, "NAME IS INVLAID..NAME CANNOT HAVE INTEGER VALUES"); NAME.setText(""); name_status.setText("INVALID"); }*/ } private void label1ComponentHidden(java.awt.event.ComponentEvent evt) { // TODO add your handling code here: } private void IDFocusGained(java.awt.event.FocusEvent evt) { // TODO add your handling code here:
  26. 26. } private void label1HierarchyChanged(java.awt.event.HierarchyEvent evt) { // TODO add your handling code here: } private void label1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: } private void COUNTRYFocusGained(java.awt.event.FocusEvent evt) { // TODO add your handling code here: } private void COUNTRYFocusLost(java.awt.event.FocusEvent evt) { // TODO add your handling code here: Success.setText(""); } private void COUNTRYActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void course_comboActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: /*course_combo .addItem("B Tech");course_combo.addItem("M Tech");course_combo.addItem("MCA");*/} /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); }
  27. 27. // Variables declaration - do not modify private java.awt.TextField AGE; private java.awt.TextField BRANCH; private java.awt.TextField COUNTRY; private java.awt.TextField EMAIL; private javax.swing.JButton EXIT; private java.awt.TextField ID; private java.awt.Label Label8; private java.awt.TextField NAME; private java.awt.TextField PLACE; private javax.swing.JButton RESET; private java.awt.Label Success; private javax.swing.JToggleButton UPDATE; private java.awt.Label age_status; private javax.swing.ButtonGroup buttonGroup1; private javax.swing.ButtonGroup buttonGroup2; private javax.swing.JComboBox course_combo; private javax.swing.JComboBox date_combo; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private java.awt.Label label1; private java.awt.Label label2; private java.awt.Label label3; private java.awt.Label label4; private java.awt.Label label5; private java.awt.Label label6; private java.awt.Label label7; private javax.swing.JComboBox month_combo; private java.awt.Label name_status; private javax.swing.JLabel status1; private javax.swing.JButton submit; private javax.swing.JComboBox year_combo; // End of variables declaration}PROGRAM CODE FOR UPDATION FORMCODE:// the name of my java file is s.java
  28. 28. /* * s.java * * Created on October 17, 2010, 10:11 PM */import java.sql.*;/** * * @author RESHMA */public class s_1 extends javax.swing.JFrame { /** Creates new form s */ public s_1() { initComponents(); loaddetails(); } public void loaddetails() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url="jdbc:odbc:student"; Connection con=DriverManager.getConnection(url,"",""); Statement stmt=con.createStatement(); String sql="Select NAME from student"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) { combo.addItem(rs.getString(1)); } status1.setText("WELCOME "+NAME.getText()+"PLEASE UPDATE YOURENTRIES !!!!!!!!!!"); stmt.close(); con.close(); } catch(Exception e) { javax.swing.JOptionPane.showMessageDialog(null, "Error...!"); } } /** This method is called from within the constructor to * initialize the form.
  29. 29. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */// <editor-fold defaultstate="collapsed" desc="Generated Code">private void initComponents() { status = new java.awt.Label(); label1 = new java.awt.Label(); Label8 = new java.awt.Label(); label3 = new java.awt.Label(); label4 = new java.awt.Label(); label5 = new java.awt.Label(); label6 = new java.awt.Label(); label7 = new java.awt.Label(); ID = new java.awt.TextField(); AGE = new java.awt.TextField(); BRANCH = new java.awt.TextField(); COUNTRY = new java.awt.TextField(); PLACE = new java.awt.TextField(); EMAIL = new java.awt.TextField(); EXIT = new javax.swing.JButton(); RESET = new javax.swing.JButton(); combo = new javax.swing.JComboBox(); UPDATE = new javax.swing.JToggleButton(); DELETE = new javax.swing.JToggleButton(); jLabel1 = new javax.swing.JLabel(); status1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); BIRTH = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); BIRTH1 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); BIRTH2 = new javax.swing.JLabel(); BIRTH3 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); NAME = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(143, 115, 132)); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setForeground(new java.awt.Color(50, 0, 50));
  30. 30. label1.setAlignment(java.awt.Label.CENTER);label1.setBackground(new java.awt.Color(255, 51, 255));label1.setFont(new java.awt.Font("Andalus", 2, 18));label1.setForeground(new java.awt.Color(102, 102, 0));label1.setText("UPDATION FORM");label1.addInputMethodListener(new java.awt.event.InputMethodListener() { public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { label1InputMethodTextChanged(evt); }});Label8.setFont(new java.awt.Font("Andalus", 0, 12));Label8.setForeground(new java.awt.Color(255, 102, 255));Label8.setText("ID");label3.setFont(new java.awt.Font("Andalus", 0, 12));label3.setForeground(new java.awt.Color(255, 102, 255));label3.setText(" AGE :");label4.setFont(new java.awt.Font("Andalus", 0, 12));label4.setForeground(new java.awt.Color(255, 102, 255));label4.setText("BRANCH:");label5.setFont(new java.awt.Font("Andalus", 0, 12));label5.setForeground(new java.awt.Color(255, 102, 255));label5.setText("COUNTRY");label6.setFont(new java.awt.Font("Andalus", 0, 12));label6.setForeground(new java.awt.Color(255, 102, 255));label6.setText("PLACE");label7.setFont(new java.awt.Font("Andalus", 0, 12));label7.setForeground(new java.awt.Color(255, 102, 255));label7.setText("E-mail ID");ID.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { IDActionPerformed(evt); }});EMAIL.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EMAILActionPerformed(evt);
  31. 31. }});EXIT.setBackground(new java.awt.Color(0, 51, 255));EXIT.setFont(new java.awt.Font("Andalus", 0, 11));EXIT.setForeground(new java.awt.Color(255, 255, 51));EXIT.setText("EXIT");EXIT.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EXITActionPerformed(evt); }});RESET.setBackground(new java.awt.Color(51, 51, 255));RESET.setFont(new java.awt.Font("Andalus", 0, 12));RESET.setForeground(new java.awt.Color(255, 255, 0));RESET.setText("CLEAR");RESET.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RESETActionPerformed(evt); }});combo.setBackground(new java.awt.Color(255, 204, 204));combo.setFont(new java.awt.Font("Andalus", 0, 11));combo.setForeground(new java.awt.Color(255, 255, 51));combo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { comboActionPerformed(evt); }});UPDATE.setBackground(new java.awt.Color(0, 51, 255));UPDATE.setFont(new java.awt.Font("Andalus", 0, 11));UPDATE.setForeground(new java.awt.Color(255, 255, 51));UPDATE.setText("UPDATE");UPDATE.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UPDATEActionPerformed(evt); }});DELETE.setBackground(new java.awt.Color(0, 51, 255));DELETE.setFont(new java.awt.Font("Andalus", 0, 11));DELETE.setForeground(new java.awt.Color(255, 255, 51));DELETE.setText("DELETE USER");
  32. 32. DELETE.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { DELETEActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Andalus", 0, 12)); jLabel1.setForeground(new java.awt.Color(255, 51, 204)); jLabel1.setText("STUDENT NAME"); status1.setFont(new java.awt.Font("Andalus", 0, 11)); jLabel2.setFont(new java.awt.Font("Andalus", 0, 12)); jLabel2.setForeground(new java.awt.Color(255, 102, 255)); jLabel2.setText("NAME :"); jLabel3.setFont(new java.awt.Font("Andalus", 0, 12)); jLabel3.setForeground(new java.awt.Color(255, 102, 255)); jLabel3.setText("COURSE"); jLabel4.setFont(new java.awt.Font("Andalus", 0, 11)); jLabel4.setForeground(new java.awt.Color(255, 51, 255)); jLabel4.setText("DATE OF BIRTH"); jLabel5.setText("-"); jLabel6.setText("-"); NAME.setFont(new java.awt.Font("Andalus", 0, 12)); NAME.setForeground(new java.awt.Color(102, 102, 255)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(151, 151, 151) .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE,270, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(129, 129, 129) .addComponent(status1, javax.swing.GroupLayout.PREFERRED_SIZE,412, javax.swing.GroupLayout.PREFERRED_SIZE))
  33. 33. .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING,layout.createSequentialGroup() .addGap(22, 22, 22).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(label6,javax.swing.GroupLayout.PREFERRED_SIZE, 70,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(label7,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(label5,javax.swing.GroupLayout.PREFERRED_SIZE, 77,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) .addComponent(jLabel3,javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jLabel2) .addGap(18, 18, 18)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup() .addComponent(Label8,javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE) .addGap(34, 34, 34)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup() .addComponent(label3,javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE) .addGap(24, 24, 24)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup() .addComponent(label4,javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE) .addGap(26, 26, 26))) .addComponent(jLabel4,javax.swing.GroupLayout.PREFERRED_SIZE, 95,javax.swing.GroupLayout.PREFERRED_SIZE))
  34. 34. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,false) .addComponent(EMAIL,javax.swing.GroupLayout.Alignment.LEADING,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(COUNTRY,javax.swing.GroupLayout.Alignment.LEADING,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(PLACE,javax.swing.GroupLayout.Alignment.LEADING,javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE) .addComponent(BRANCH,javax.swing.GroupLayout.Alignment.LEADING,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)) .addGap(91, 91, 91).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(BIRTH2,javax.swing.GroupLayout.PREFERRED_SIZE, 54,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(123, 123, 123) .addComponent(jLabel8,javax.swing.GroupLayout.PREFERRED_SIZE, 67,javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(layout.createSequentialGroup() .addComponent(BIRTH,javax.swing.GroupLayout.PREFERRED_SIZE, 23,javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel5,javax.swing.GroupLayout.PREFERRED_SIZE, 12,javax.swing.GroupLayout.PREFERRED_SIZE)
  35. 35. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(BIRTH1,javax.swing.GroupLayout.PREFERRED_SIZE, 19,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6,javax.swing.GroupLayout.PREFERRED_SIZE, 13,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(BIRTH3,javax.swing.GroupLayout.PREFERRED_SIZE, 48,javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel9).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING,layout.createSequentialGroup() .addComponent(ID,javax.swing.GroupLayout.PREFERRED_SIZE, 22,javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(130, 130, 130) .addComponent(jLabel1,javax.swing.GroupLayout.PREFERRED_SIZE, 94,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(combo,javax.swing.GroupLayout.PREFERRED_SIZE, 140,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(NAME,javax.swing.GroupLayout.PREFERRED_SIZE, 133,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AGE,javax.swing.GroupLayout.PREFERRED_SIZE, 32,javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 119,Short.MAX_VALUE)
  36. 36. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,false) .addGroup(layout.createSequentialGroup() .addComponent(DELETE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) .addComponent(EXIT,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(UPDATE,javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE) .addComponent(RESET,javax.swing.GroupLayout.Alignment.TRAILING,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE))))) .addGap(139, 139, 139)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING,layout.createSequentialGroup() .addGap(284, 284, 284) .addComponent(jLabel7))) .addGap(367, 367, 367))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup() .addGap(82, 82, 82).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, 28,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(status1, javax.swing.GroupLayout.PREFERRED_SIZE, 23,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  37. 37. .addComponent(ID, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1,javax.swing.GroupLayout.PREFERRED_SIZE, 32,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(combo,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(Label8, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,false) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(NAME, javax.swing.GroupLayout.PREFERRED_SIZE,23, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE,19, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup().addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3,javax.swing.GroupLayout.PREFERRED_SIZE, 24,javax.swing.GroupLayout.PREFERRED_SIZE))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)
  38. 38. .addComponent(AGE, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(RESET, javax.swing.GroupLayout.PREFERRED_SIZE,34, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(DELETE, javax.swing.GroupLayout.PREFERRED_SIZE,32, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(20, 20, 20).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(BRANCH,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(17, 17, 17).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(COUNTRY,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(PLACE, javax.swing.GroupLayout.DEFAULT_SIZE,24, Short.MAX_VALUE) .addComponent(label6, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(20, 20, 20).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  39. 39. .addComponent(label7, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(EMAIL, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(UPDATE, javax.swing.GroupLayout.PREFERRED_SIZE,31, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(EXIT, javax.swing.GroupLayout.PREFERRED_SIZE, 31,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(jLabel8) .addGap(8, 8, 8).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(BIRTH2) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup().addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16,Short.MAX_VALUE).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,false) .addComponent(BIRTH,javax.swing.GroupLayout.Alignment.TRAILING,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(jLabel4,javax.swing.GroupLayout.Alignment.TRAILING,javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)) .addComponent(BIRTH1,javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE) .addComponent(jLabel6)
  40. 40. .addComponent(BIRTH3,javax.swing.GroupLayout.PREFERRED_SIZE, 23,javax.swing.GroupLayout.PREFERRED_SIZE))))) .addGroup(layout.createSequentialGroup() .addGap(9, 9, 9) .addComponent(jLabel7) .addGap(48, 48, 48))) .addGap(118, 118, 118)) ); pack(); }// </editor-fold> private void IDActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void EXITActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: System.exit(0); //javax.swing.JOptionPane.showMessageDialog(null, "BYE"+NAME.getText()); } private void RESETActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: ID.setText(""); NAME.setText(""); AGE.setText(""); BRANCH.setText(""); COUNTRY.setText(""); PLACE.setText(""); EMAIL.setText(""); status.setText(""); } private void comboActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { status.setText(""); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url="jdbc:odbc:student"; Connection con=DriverManager.getConnection(url,"",""); Statement stmt=con.createStatement(); String s="Select * from student where NAME="+combo.getSelectedItem()+"";
  41. 41. ResultSet rs=stmt.executeQuery(s);// String FN="";String I="";String NM="";String AG="";String BR="";String CR="";String PL="";String EM="";String CRS="";String DFB="";String MFB="";String YFB="";while(rs.next()){// FN=rs.getString("FIRSTNAME"); I=rs.getString("ID"); NM=rs.getString("NAME"); AG=rs.getString("AGE"); BR=rs.getString("BRANCH"); CR=rs.getString("COUNTRY"); PL=rs.getString("PLACE"); EM=rs.getString("EMAIL"); CRS=rs.getString("COURSE"); DFB=rs.getString("DATE_"); MFB=rs.getString("OF"); YFB=rs.getString("BIRTH"); } ID.setText(I); NAME.setText(NM); AGE.setText(AG); BRANCH.setText(BR); COUNTRY.setText(CR); PLACE.setText(PL); EMAIL.setText(EM); jLabel9.setText(CRS); BIRTH.setText(DFB);// BIRTH IS THE FIELD NAME ... BIRTH1.setText(MFB); BIRTH3.setText(YFB);
  42. 42. status1.setText("WELCOME "+NAME.getText()+"PLEASE UPDATE YOURENTRIE!!!!!!!!!!"); stmt.close(); con.close(); } catch(Exception e) { status.setText("Error In Loading...!"); } } private void UPDATEActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url="jdbc:odbc:student"; Connection con=DriverManager.getConnection(url,"",""); Statement stmt=con.createStatement(); String s="Update student set ID="+ID.getText()+",NAME="+NAME.getText()+",AGE="+AGE.getText()+",BRANCH="+BRANCH.getText()+",COUNTRY="+COUNTRY.getText()+",PLACE="+PLACE.getText()+",EMAIL="+EMAIL.getText()+" where NAME="+combo.getSelectedItem()+""; stmt.executeUpdate(s); javax.swing.JOptionPane.showMessageDialog(null,"Sucessfullly Updated...!"); javax.swing.JOptionPane.showMessageDialog(null,"THANK YOU"+NAME.getText()+"!!!!"); } catch(Exception e) { status.setText("Error!"); } } private void label1InputMethodTextChanged(java.awt.event.InputMethodEvent evt) { // TODO add your handling code here: } private void EMAILActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void DELETEActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try {
  43. 43. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url="jdbc:odbc:student"; Connection con=DriverManager.getConnection(url,"",""); Statement stmt=con.createStatement(); String d="DELETE from student where NAME="+combo.getSelectedItem()+""; stmt.executeUpdate(d); //ResultSet rs=stmt.executeQuery(d); javax.swing.JOptionPane.showMessageDialog(null, "ENTRY"+NAME.getText()+" DELETED"); combo.removeItem(combo.getSelectedItem()); } catch(Exception e) { status.setText("Error!"); } } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new s().setVisible(true); } }); } // Variables declaration - do not modify private java.awt.TextField AGE; private javax.swing.JLabel BIRTH; private javax.swing.JLabel BIRTH1; private javax.swing.JLabel BIRTH2; private javax.swing.JLabel BIRTH3; private java.awt.TextField BRANCH; private java.awt.TextField COUNTRY; private javax.swing.JToggleButton DELETE; private java.awt.TextField EMAIL; private javax.swing.JButton EXIT; private java.awt.TextField ID; private java.awt.Label Label8; private javax.swing.JLabel NAME; private java.awt.TextField PLACE; private javax.swing.JButton RESET; private javax.swing.JToggleButton UPDATE; private javax.swing.JComboBox combo; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2;
  44. 44. private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private java.awt.Label label1; private java.awt.Label label3; private java.awt.Label label4; private java.awt.Label label5; private java.awt.Label label6; private java.awt.Label label7; private java.awt.Label status; private javax.swing.JLabel status1; // End of variables declaration} RESULT
  45. 45. CONCLUSION After we have completed the assignment we are sure that the problems in the existing system wouldovercome. The “STUDENT APPLICATION FORM” process made computerized to reduce humanerrors and to increase the efficiency. The main focus of this assignment is to lessen human efforts.The maintenance of the records is made efficient, as all the records are stored in the ACCESSdatabase, through which data can be retrieved easily. The navigation control is provided in all theforms to navigate through the large amount of records. The editing is also made simpler. The userhas to just type in the required field and press the submit button to get the desired information. Ourmain aim of the assignment is to enter the details of the student and to get the correct informationabout a particular student. The problems, which existed in the earlier system, have been removed toa large extent. And it is expected that this assignment will go a long way in satisfying student’srequirements.

×