student registration form using swing source code
#3

package eg.DBConn;

import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.awt.*;

public class StudInformation extends JFrame implements ActionListener
{
JTextField txt_id,txt_name,txt_age,txt_course,txt_semester,txt_tutor;
JLabel lbl_title,lbl_id,lbl_name,lbl_age,lbl_course,lbl_semester,lbl_tutor;
JButton btn_insert,btn_delete,btn_update,btn_clear,btn_search;

Connection c;

public StudInformation()
{
lbl_title=new JLabel("Student Information");
lbl_id=new JLabel("Id");
lbl_name=new JLabel("Name");
lbl_age=new JLabel("Age");
lbl_course=new JLabel("Course");
lbl_semester=new JLabel("Semester");
lbl_tutor=new JLabel("Tutor");

txt_id=new JTextField(20);
txt_name=new JTextField(20);

txt_age=new JTextField(20);
txt_course=new JTextField(20);
txt_semester=new JTextField(20);
txt_tutor=new JTextField(20);

btn_insert=new JButton("Insert");
btn_delete=new JButton("Delete");
btn_update=new JButton("Update");
btn_clear=new JButton("Clear");
btn_search=new JButton("Search");

btn_insert.addActionListener(this);
btn_delete.addActionListener(this);
btn_update.addActionListener(this);
btn_clear.addActionListener(this);
btn_search.addActionListener(this);

JPanel p1,p2,p3;

p1=new JPanel();
p1.setLayout(new FlowLayout());
p1.add(lbl_title);

p2=new JPanel();
p2.setLayout(new GridLayout(6,2));
p2.add(lbl_id);
p2.add(txt_id);
p2.add(lbl_name);
p2.add(txt_name);
p2.add(lbl_age);
p2.add(txt_age);
p2.add(lbl_course);
p2.add(txt_course);
p2.add(lbl_semester);
p2.add(txt_semester);
p2.add(lbl_tutor);
p2.add(txt_tutor);


p3=new JPanel();
p3.setLayout(new FlowLayout());
p3.add(btn_insert);
p3.add(btn_delete);
p3.add(btn_update);
p3.add(btn_clear);
p3.add(btn_search);


Container c=getContentPane();
c.setLayout(null);
p1.setBounds(20,20,300,40);
p2.setBounds(10,80,200,320);
p3.setBounds(10,400,300,80);

c.add(p1);
c.add(p2);
c.add(p3);
}

public void actionPerformed(ActionEvent ae)
{

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c=DriverManager.getConnection("jdbc:odbcConfusedtud");
}
catch(Exception ex)
{
}
String btn=ae.getActionCommand();
if(btn.equals("Clear"))
{

txt_id.setText("");
txt_name.setText("");
txt_age.setText("");
txt_course.setText("");
txt_semester.setText("");
txt_tutor.setText("");
}
if(btn.equals("Search"))
{
String id=txt_id.getText();
try{
String query1="Select *from stud where id='"+id+"'";
Statement st=c.createStatement();
ResultSet rs=st.executeQuery(query1);
while(rs.next())
{
txt_id.setText(rs.getString("id"));
txt_name.setText(rs.getString("name"));
txt_age.setText(rs.getString("age"));
txt_course.setText(rs.getString("course"));
txt_semester.setText(rs.getString("semester"));
txt_tutor.setText(rs.getString("tutor"));

}
}
catch(Exception ex)
{
}
}
if(btn.equals("Update"))
{
String s1=txt_id.getText();
String s2=txt_name.getText();
String s3=txt_age.getText();
String s4=txt_course.getText();
String s5=txt_semester.getText();
String s6=txt_tutor.getText();
try{
PreparedStatement ps=c.prepareStatement("Update stud set id=?,name=?,age=?,course=?,semester=?,tutor=? where id=?");
ps.setString(1,s1);
ps.setString(2,s2);
ps.setString(3,s3);
ps.setString(4,s4);
ps.setString(5,s5);
ps.setString(6,s6);
ps.setString(7,s1);
ps.executeUpdate();
JOptionPane.showMessageDialog(null,"Successfully Updated");
txt_id.setText("");
txt_name.setText("");
txt_age.setText("");
txt_course.setText("");
txt_semester.setText("");
txt_tutor.setText("");
}
catch(Exception ex)
{
}
}
if(btn.equals("Delete"))
{
String s1=txt_id.getText();
try{
PreparedStatement ps=c.prepareStatement("Delete *from stud where id=?");
ps.setString(1,s1);
ps.executeUpdate();
JOptionPane.showMessageDialog(null,"Successfully deleted");
txt_id.setText("");
txt_name.setText("");
txt_age.setText("");
txt_course.setText("");
txt_semester.setText("");
txt_tutor.setText("");
}
catch(Exception ex)
{
}
}
if(btn.equals("Insert"))
{
String s1=txt_id.getText();
String s2=txt_name.getText();
String s3=txt_age.getText();
String s4=txt_course.getText();
String s5=txt_semester.getText();
String s6=txt_tutor.getText();
try{
PreparedStatement ps=c.prepareStatement("insert into stud values(?,?,?,?,?,?)");
ps.setString(1,s1);
ps.setString(2,s2);
ps.setString(3,s3);
ps.setString(4,s4);
ps.setString(5,s5);
ps.setString(6,s6);
ps.executeUpdate();
JOptionPane.showMessageDialog(null,"Successfully Inserted");
txt_id.setText("");
txt_name.setText("");
txt_age.setText("");
txt_course.setText("");
txt_semester.setText("");
txt_tutor.setText("");
}
catch(Exception ex)
{
}

}



}

public static void main(String args[])
{
StudInformation stud=new StudInformation();
stud.setVisible(true);
stud.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
stud.setSize(new Dimension(400,520));
}
}
package eg.DBConn;

import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.awt.*;

public class StudInformation extends JFrame implements ActionListener
{
JTextField txt_id,txt_name,txt_age,txt_course,txt_semester,txt_tutor;
JLabel lbl_title,lbl_id,lbl_name,lbl_age,lbl_course,lbl_semester,lbl_tutor;
JButton btn_insert,btn_delete,btn_update,btn_clear,btn_search;

Connection c;

public StudInformation()
{
lbl_title=new JLabel("Student Information");
lbl_id=new JLabel("Id");
lbl_name=new JLabel("Name");
lbl_age=new JLabel("Age");
lbl_course=new JLabel("Course");
lbl_semester=new JLabel("Semester");
lbl_tutor=new JLabel("Tutor");

txt_id=new JTextField(20);
txt_name=new JTextField(20);

txt_age=new JTextField(20);
txt_course=new JTextField(20);
txt_semester=new JTextField(20);
txt_tutor=new JTextField(20);

btn_insert=new JButton("Insert");
btn_delete=new JButton("Delete");
btn_update=new JButton("Update");
btn_clear=new JButton("Clear");
btn_search=new JButton("Search");

btn_insert.addActionListener(this);
btn_delete.addActionListener(this);
btn_update.addActionListener(this);
btn_clear.addActionListener(this);
btn_search.addActionListener(this);

JPanel p1,p2,p3;

p1=new JPanel();
p1.setLayout(new FlowLayout());
p1.add(lbl_title);

p2=new JPanel();
p2.setLayout(new GridLayout(6,2));
p2.add(lbl_id);
p2.add(txt_id);
p2.add(lbl_name);
p2.add(txt_name);
p2.add(lbl_age);
p2.add(txt_age);
p2.add(lbl_course);
p2.add(txt_course);
p2.add(lbl_semester);
p2.add(txt_semester);
p2.add(lbl_tutor);
p2.add(txt_tutor);


p3=new JPanel();
p3.setLayout(new FlowLayout());
p3.add(btn_insert);
p3.add(btn_delete);
p3.add(btn_update);
p3.add(btn_clear);
p3.add(btn_search);


Container c=getContentPane();
c.setLayout(null);
p1.setBounds(20,20,300,40);
p2.setBounds(10,80,200,320);
p3.setBounds(10,400,300,80);

c.add(p1);
c.add(p2);
c.add(p3);
}

public void actionPerformed(ActionEvent ae)
{

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c=DriverManager.getConnection("jdbc:odbcConfusedtud");
}
catch(Exception ex)
{
}
String btn=ae.getActionCommand();
if(btn.equals("Clear"))
{

txt_id.setText("");
txt_name.setText("");
txt_age.setText("");
txt_course.setText("");
txt_semester.setText("");
txt_tutor.setText("");
}
if(btn.equals("Search"))
{
String id=txt_id.getText();
try{
String query1="Select *from stud where id='"+id+"'";
Statement st=c.createStatement();
ResultSet rs=st.executeQuery(query1);
while(rs.next())
{
txt_id.setText(rs.getString("id"));
txt_name.setText(rs.getString("name"));
txt_age.setText(rs.getString("age"));
txt_course.setText(rs.getString("course"));
txt_semester.setText(rs.getString("semester"));
txt_tutor.setText(rs.getString("tutor"));

}
}
catch(Exception ex)
{
}
}
if(btn.equals("Update"))
{
String s1=txt_id.getText();
String s2=txt_name.getText();
String s3=txt_age.getText();
String s4=txt_course.getText();
String s5=txt_semester.getText();
String s6=txt_tutor.getText();
try{
PreparedStatement ps=c.prepareStatement("Update stud set id=?,name=?,age=?,course=?,semester=?,tutor=? where id=?");
ps.setString(1,s1);
ps.setString(2,s2);
ps.setString(3,s3);
ps.setString(4,s4);
ps.setString(5,s5);
ps.setString(6,s6);
ps.setString(7,s1);
ps.executeUpdate();
JOptionPane.showMessageDialog(null,"Successfully Updated");
txt_id.setText("");
txt_name.setText("");
txt_age.setText("");
txt_course.setText("");
txt_semester.setText("");
txt_tutor.setText("");
}
catch(Exception ex)
{
}
}
if(btn.equals("Delete"))
{
String s1=txt_id.getText();
try{
PreparedStatement ps=c.prepareStatement("Delete *from stud where id=?");
ps.setString(1,s1);
ps.executeUpdate();
JOptionPane.showMessageDialog(null,"Successfully deleted");
txt_id.setText("");
txt_name.setText("");
txt_age.setText("");
txt_course.setText("");
txt_semester.setText("");
txt_tutor.setText("");
}
catch(Exception ex)
{
}
}
if(btn.equals("Insert"))
{
String s1=txt_id.getText();
String s2=txt_name.getText();
String s3=txt_age.getText();
String s4=txt_course.getText();
String s5=txt_semester.getText();
String s6=txt_tutor.getText();
try{
PreparedStatement ps=c.prepareStatement("insert into stud values(?,?,?,?,?,?)");
ps.setString(1,s1);
ps.setString(2,s2);
ps.setString(3,s3);
ps.setString(4,s4);
ps.setString(5,s5);
ps.setString(6,s6);
ps.executeUpdate();
JOptionPane.showMessageDialog(null,"Successfully Inserted");
txt_id.setText("");
txt_name.setText("");
txt_age.setText("");
txt_course.setText("");
txt_semester.setText("");
txt_tutor.setText("");
}
catch(Exception ex)
{
}

}



}

public static void main(String args[])
{
StudInformation stud=new StudInformation();
stud.setVisible(true);
stud.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
stud.setSize(new Dimension(400,520));
}
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Tagged Pages: registration form with gui swing program source from to design, registration and login project in java swing source code, student form registration in java using swing source code download, java program for registration form using swing, seminar registration example with source code, java code for application form, a simple registration form project using java swing,
Popular Searches: swing for student details in java, student registration form code in vb6, student registration form in html source code, automated student registration pdf, student registration form in android source code, code of registration form in swing, online student registration system source code,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Messages In This Thread
student registration form using swing source code - by Guest - 17-10-2012, 07:24 PM
RE: student registration form using swing source code - by Guest - 24-04-2013, 08:46 AM
KuYHmIGUHjrjPXibQo - by wjCnEFn - 20-10-2014, 10:38 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  student internal mark management project download 2 2,675 01-01-2019, 06:46 PM
Last Post: Krishnakumar2000
  free download source code of online college magazine 5 17,905 29-06-2018, 10:09 AM
Last Post: Guest
Smile sbi savings account to rsp convertion form 5 3,507 15-06-2018, 07:42 AM
Last Post: Atanu Dey
  opengl source code for butterfly 3 3,287 14-05-2018, 08:57 AM
Last Post: Akshatha k
  program code of solar tracking system using 8051 microcontroller 6 23,422 03-05-2018, 09:30 PM
Last Post: Guest
  ice cream parlour management system in vb source code 4 5,291 04-04-2018, 11:58 PM
Last Post: vprk77
  matlab code for vehicle tracking using unscented kalman filter 3 16,948 26-03-2018, 08:57 PM
Last Post: fodayj
  source code in php for online training and placement cell management 1 6,691 23-03-2018, 09:06 AM
Last Post: ritzi
  free download college website project in html with source code 2 4,623 24-02-2018, 10:46 AM
Last Post: Guest
  matlab code for facial expression recognition using frequency domain 1 2,688 19-02-2018, 06:03 PM
Last Post: Guest

Forum Jump: