student registration form using swing source code
#1

I want to create a windows appliation is java using Swing in Netbeans. I want to create the student maintenance details, Mysql as backend. I dont know how to load the frames in single form. Example, if the user give user name and password in the text box and then click the login button, it will load the next frame in same form like web application.
Reply
#2
registration form of a student containing name,dob,age in swings
Reply
#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
#4
xanax and other drug interactions - order cheap xanax no prescription
Reply
#5

seamless handoff with multiple radios 802.11 wlans ns2 code
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 using swing in java, registration form in java swing with database, student registration form using awt in java program, simple student registration form with update delete insert and exit buttons using java swing and mysql, java code for student registration using swing and event, java program for registration form using swing, registration form in java swing with validation,
Popular Searches: java swing code of railway reservation form, registration form using joptionpane, code for student registration form in php, student registration html code, java swing registration form example, electronics seminars postersng swing source code, student information system project report in java swing,

[-]
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)

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

Forum Jump: