Professional Documents
Culture Documents
Page | 1
SOFTWARE AND HARDWARE REQUIREMENTS
Hardware Specifications:
The following are the minimal hardware requirements to execute this project
Software Specifications:
The following are the minimal software requirements to execute this project
Language : JAVA
Frontend : Swing
Page | 2
Platform Used
Introduction to Java
Java Features
Appletviewer
Javac
Java
Javap
Page | 3
Synopsis
Purpose :
Page | 4
FEASIBILITY STUDY
Operational feasibility;
It is a user friendly
The authorized user can learn in one or two days
That’s why its operational feasible
Technical Feasibility
Economic feasible
Page | 5
System Study
Existing System
In the existing system, the manual process, receiving data’s from student
are done through manual records. These records are entered in manual process.
In this process will take long time, separate workers need to maintaining the
databases. All the college details are stored via separate databases. It will take
long time due to this process time waste, money waste etc...
Page | 6
Need For Proposed System
Page | 7
“Identity Card Generation System” is to manage the task related to the college
students and to reduce time to searching of appropriate candidates in college.
This system provides the detail structure of the student’s details and its
departments. It synchronizes the working of all the departments. It looks on all
aspects of a student’s so that a student can be recognize easily whether it belong
to the specific college or not. It is the easiest way to manage all functionalities
of a college, which facilitates colleges to maintain the functionality related to
students
Page | 8
DATA FLOW DIAGRAM
View All
By name
Page | 9
Database Screenshots
Login:
A. Design:
Page | 10
B. Table:
Page | 11
Details:
A. Design
Page | 12
B. Table:
Page | 13
CODING
AND
SCREENSHOT
Page | 14
Welcome Screen:
Page | 15
CODING
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class FrontPage extends JFrame implements MouseListener
{
JLabel mats,info,ma;
JPanel p1;
ImageIcon icon;
Image image;
FrontPage()
{
icon = new ImageIcon("mats.jpg");
p1 = new JPanel();
{
protected void paintComponent(Graphics g)
{
g.drawImage(icon.getImage(), 0, 0, null);
super.paintComponent(g);
}
};
p1.setOpaque( false );
Container cp =getContentPane();
mats = new JLabel("Welcome to MATS University");
mats.setFont(new Font("Times New Roman", Font.BOLD, 30));
ma = new JLabel("STUDENT ID CARD GENERATION SYSTEM");
ma.setFont(new Font("Times New Roman", Font.BOLD, 30));
info = new JLabel("...Click Here...");
info.setFont(new Font("Times New Roman", Font.BOLD, 30));
info.setPreferredSize(new Dimension(200,800));
p1.add(mats);
p1.add(ma);
p1.add(info);
cp.add(p1);
addMouseListener(this);
setTitle("HOME");
setSize(700,550);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo( null );
setResizable(false);
setVisible(true);
}
public void mouseClicked(MouseEvent e)
{
try
{
new Login();
}
catch(Exception m)
{
Page | 16
JOptionPane.showMessageDialog(null, m.getMessage());
}
dispose();
}
public void mouseEntered(MouseEvent e)
{
}
public void mouseExited(MouseEvent e)
{
}
public void mousePressed(MouseEvent e)
{
}
public void mouseReleased(MouseEvent e)
{
}
}
class First
{
public static void main(String args[])
{
new FrontPage();
}
}
Page | 17
Login Screen:
Page | 18
CODING
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
class Login extends JFrame implements ActionListener
{
static int counter=0;
JButton OK,EXIT;
JPanel panel;
JLabel label1,label2;
final JTextField text1,text2;
ImageIcon image;
Login()
{
label1 = new JLabel();
label1.setText("Username:");
text1 = new JTextField(15);
label2 = new JLabel();
label2.setText("Password:");
text2 = new JPasswordField(15);
//label1.setPreferredSize(new Dimension(50,50));
//label2.setPreferredSize(new Dimension(80,20));
OK=new JButton("OK");
EXIT=new JButton("EXIT");
setLocation(450,400);
panel=new JPanel();
OK.setMnemonic(KeyEvent.VK_L);
JPanel ipan= new JPanel();
image = new ImageIcon("Lock..gif");
JLabel imgl = new JLabel(image);
imgl.setPreferredSize(new Dimension(260,200));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(OK);
panel.add(EXIT);
ipan.add(imgl);
ipan.setBackground(Color.blue);
panel.add(ipan);
add(panel);
setSize(300,350);
setLocationRelativeTo( null );
setResizable(false);
OK.addActionListener(this);
EXIT.addActionListener(this);
setTitle("LOGIN FORM");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
Page | 19
{
//String value1=text1.getText();
//String value2=text2.getText();
if (ae.getSource()==OK)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:sss");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from Login where
Name='"+text1.getText()+"' and Password= '"+text2.getText()+"'");
if(rs.next())
{
new ICardGeneration();
dispose();
}
else
{
counter+=1
JOptionPane.showMessageDialog(this," ** User Name OR
Password Incorrect **","Authentication Falied",JOptionPane.ERROR_MESSAGE);
text1.setText("");
text2.setText("");
if(counter==3)
{
JOptionPane.showMessageDialog(this," System will
Terminate within 5 Seconds","",JOptionPane.INFORMATION_MESSAGE);
try
{
Thread.sleep(5000);
}
catch(Exception ee)
{
}
System.exit(0);
}
return;
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
if (ae.getSource()==EXIT)
{
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
}
Page | 20
Main Screen:
Page | 21
CODING
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import java.util.*;
ICardGeneration()
{
frame = new JFrame("ICard Generation");
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//frame.setLocation(screenWidth/4, screenHeight/4);
frame.setIconImage(img);
addWidgets();
frame.show();
}
Page | 22
public void addWidgets()
{
menubar.add(menu);
menu = new JMenu("Options");
menuItem = new JMenuItem("Add New");
menu.add(menuItem);
menuItem.addActionListener(this);
Page | 23
JButton AddNew = new JButton("Add New");
JButton Search = new JButton("Search");
JButton Update = new JButton("Update");
JButton ViewList = new JButton("View All");
JLabel label = new JLabel("<HTML><FONT FACE = ARIAL SIZE =
5><B>Use The options below and In The Menu To Manage ICard
Generation");
topPanel.add(label);
bottomPanel.add(AddNew);
bottomPanel.add(Update);
bottomPanel.add(Search);
bottomPanel.add(ViewList);
frame.getContentPane().add(topPanel, BorderLayout.NORTH);
frame.getContentPane().add(centerPanel,
BorderLayout.CENTER);
frame.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
// frame.setResizable(false);
}
Page | 25
Add New Entry:
Page | 26
CODING
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JOptionPane;
import java.sql.*;
import java.util.Date;
import java.text.*;
ICard()
{
setTitle("Add New Student Details");
img = new ImageIcon("mats.jpg");
p1 = new JPanel()
{
protected void paintComponent(Graphics g)
{
g.drawImage(img.getImage(), 0, 0, null);
super.paintComponent(g);
}
};
p1.setOpaque( false );
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
Page | 27
insert = new JButton("Insert");
cancel = new JButton("Cancel");
browse=new JButton("Browse");
p1.setLayout(null);
image.setBorder(BorderFactory.createLineBorder(Color.black));
nt = new JTextField(18);
nt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
nt.setForeground(Color.blue);
ct=new JComboBox();
ct.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
ct.setForeground(Color.blue);
ct.addItem("MCA");
ct.addItem("MBA");
ct.addItem("BCA");
ct.addItem("PGDCA");
ct.addItem("B.COM");
ct.addItem("BBA");
ct.addItem("B.SC");
ct.addItem("BE");
try
{
m=new JRadioButton("Male");
f=new JRadioButton("Female");
group=new ButtonGroup();
group.add(m);
group.add(f);
m.getText();
m.setSelected(true);
group.add(f);
}
catch (Exception b)
{
b.printStackTrace();
}
bt=new JComboBox();
Page | 28
bt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
bt.setForeground(Color.blue);
bt.addItem("O+");
bt.addItem("A+");
bt.addItem("A-");
bt.addItem("B+");
bt.addItem("B-");
bt.addItem("AB+");
bt.addItem("AB-");
mt = new JTextField(18);
mt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
mt.setForeground(Color.blue);
dt = new JTextField(18);
dt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
dt.setForeground(Color.blue);
vt = new JTextField(d3,18);
vt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
vt.setForeground(Color.blue);
vt.setEditable(false);
datt = new JTextField((df1.format(now)),18);
datt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
datt.setForeground(Color.blue);
datt.setEditable(false);
nt.addKeyListener(new KeyAdapter()
{
public void keyTyped(KeyEvent v)
{
char c = v.getKeyChar();
if (!((c >= 'a'|| c >= 'A') && (c <= 'z' || c <= 'Z') || (c ==
KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_SPACE) || (c == KeyEvent.VK_DELETE)))
{
getToolkit().beep();
v.consume();
}
}
});
mt.addKeyListener(new KeyAdapter()
{
public void keyTyped(KeyEvent e)
{
char c = e.getKeyChar();
if (!((c >= '0') && (c <= '9') && (mt.getText().length()<=9)|| (c ==
KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)))
Page | 29
{
getToolkit().beep();
e.consume();
}
}
});
insert.addActionListener(this);
cancel.addActionListener(this);
browse.addActionListener(this);
ct.addActionListener(this);
bt.addActionListener(this);
mats.setBounds(180,10,150,30);
image.setBounds(200,50,80,100);
browse.setBounds(300,90,80,20);
name.setBounds(70,170,198,20);
nt.setBounds(260,170,190,20);
dob.setBounds(70,200,198,20);
dt.setBounds(260,200,190,20);
mob.setBounds(70,230,198,20);
mt.setBounds(260,230,190,20);
validup.setBounds(70,260,198,20);
vt.setBounds(260,260,190,20);
dat.setBounds(70,290,198,20);
datt.setBounds(260,290,190,20);
cls.setBounds(70,320,198,20);
ct.setBounds(260,320,190,20);
bg.setBounds(70,350,198,20);
bt.setBounds(260,350,190,20);
sx.setBounds(70,380,198,20);
m.setBounds(260,380,90,20);
f.setBounds(360,380,90,20);
sign.setBounds(40,430,134,98);
autho.setBounds(50,528,198,20);
insert.setBounds(150,580,80,20);
cancel.setBounds(250,580,80,20);
si = new ImageIcon("sign_1.jpg");
sign.setIcon(si);
cont = getContentPane();
p1.add(mats);
p1.add(image);
p1.add(browse);
p1.add(name);
p1.add(nt);
p1.add(dob);
p1.add(dt);
p1.add(mob);
p1.add(mt);
p1.add(validup);
p1.add(vt);
p1.add(dat);
Page | 30
p1.add(datt);
p1.add(cls);
p1.add(ct);
p1.add(bg);
p1.add(bt);
p1.add(sx);
p1.add(m);
p1.add(f);
p1.add(sign);
p1.add(autho);
p1.add(insert);
p1.add(cancel);
cont.add(p1);
setResizable(false);
setVisible(true);
setSize(500,650);
setLocationRelativeTo(null);
}
if (m.isSelected()==true)
{
s4=m.getText();
}
else
{
s4=f.getText();
}
if (s6.length()==10)
{
Page | 31
try
{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:odbc:sss");
Statement s = con.createStatement();
int n = s.executeUpdate("insert into details"+"( name, class,
bg, sex, dob, mob, validup, dat, image)" +
"values"+"('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+"','"+s6+"','"+s7+"','"+s8+"','"+file+"')");
s.close();
if (n > 0)
{
s = con.createStatement();
s.executeQuery("select Id from Details order By Id
ASC");
ResultSet rs=s.getResultSet();
while(rs.next())
{
ID_n = rs.getString(1);
}
//int Id1 =Integer.parseInt(ID_n);
JOptionPane.showMessageDialog(null, "Data
Inserted\nID of the Student is: "+ID_n);
nt.setText("");
dt.setText("");
mt.setText("");
vt.setText("");
}
else
{
JOptionPane.showMessageDialog(null, "Try
Again");
}
con.close();
s.close();
}
catch (Exception ex)
{
ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Name ,Date of Birth
or Valid upto not Correct");
System.out.println("Connection
problem:"+ex.getMessage());
}
}
else
{
JOptionPane.showMessageDialog(null, "Enter The Correct no. ");
}
}
if (e.getSource()==cancel)
Page | 32
{
ICardGeneration.i=0;
dispose();
}
}
Search Screen
By Id:
Page | 33
By Name:
Page | 34
CODING
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.tree.*;
import javax.swing.table.*;
class srch extends JFrame implements ActionListener
{
JFrame newFrame;
JTable searchTable;
JPanel p1,p2,p3,p4;
JLabel label1,label2,label3,label4,l5;
JComboBox ct, cd, cl;
JButton bttnSearch,bttnCancel, bttnSelect;
JTextField txtname;
JScrollPane scrollPane;
Container cont;
Object[][] data;
DefaultTableModel d;
String[] colHeads;
Statement st;
ResultSet rs;
int i;
String s2;
srch()
{
newFrame = new JFrame("Search");
newFrame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
newFrame.setSize(600,700);
newFrame.setResizable(false);
p1 = new JPanel();
p2 = new JPanel();
p3 = new JPanel();
p4 = new JPanel();
p1.setLayout(null);
label1 = new JLabel("Search Deatils by Name or ID No.");
l5 = new JLabel("Select ID or Name");
cd=new JComboBox();
cd.addItem("ID");
cd.addItem("NAME");
Page | 35
label2 = new JLabel("Enter ID:");
ct=new JComboBox();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:sss");
st=con.createStatement();
rs=st.executeQuery("select Id from Details");
while(rs.next())
{
ct.addItem(rs.getString(1));
}
rs.close();
}
catch (Exception n)
{
n.printStackTrace();
}
label3 = new JLabel("Enter Name:");
txtname = new JTextField(20);
label4 = new JLabel("Enter Class:");
cl=new JComboBox();
cl.addItem("MCA");
cl.addItem("MBA");
cl.addItem("BCA");
cl.addItem("PGDCA");
cl.addItem("B.COM");
cl.addItem("BBA");
cl.addItem("B.SC");
cl.addItem("BE");
bttnSelect=new JButton("Show");
bttnSelect.addActionListener(this);
bttnSearch = new JButton("Search!");
bttnSearch.addActionListener(this);
bttnCancel = new JButton("Cancel");
bttnCancel.addActionListener(this);
txtname.addKeyListener(new KeyAdapter()
{
public void keyTyped(KeyEvent v)
{
char c = v.getKeyChar();
if (!((c >= 'a'|| c >= 'A') && (c <= 'z' || c <= 'Z') || (c ==
KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_SPACE) || (c == KeyEvent.VK_DELETE)))
{
getToolkit().beep();
v.consume();
}
}
});
label2.setPreferredSize(new Dimension(200,20));
Page | 36
l5.setPreferredSize(new Dimension(200,20));
label3.setPreferredSize(new Dimension(200,20));
label4.setPreferredSize(new Dimension(200,20));
bttnSearch.setPreferredSize(new Dimension(200,25));
p2.setVisible(false);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
searchTable=new JTable(20,10);
p3.setVisible(false);
scrollPane=new JScrollPane(searchTable,v,h);
scrollPane.setPreferredSize(new Dimension(550,500));
label1.setBounds(200,0,500,50);
l5.setBounds(150,50,120,20);
cd.setBounds(280,50,70,20);
bttnSelect.setBounds(370,50,80,20);
bttnCancel.setBounds(460,50,80,20);
label2.setBounds(0,0,20,20);
ct.setBounds(20,0,70,20);
label3.setBounds(0,0,20,20);
label4.setBounds(0,40,20,20);
bttnSearch.setBounds(20,60,20,20);
p2.setBounds(20,70,600,500);
p3.setBounds(0,100,600,500);
p2.setLayout(new FlowLayout(FlowLayout.LEFT));
p3.setLayout(new FlowLayout(FlowLayout.CENTER));
cont=getContentPane();
p3.add(scrollPane);
p2.add(label2);
p2.add(ct);
p2.add(label3);
p2.add(txtname);
p2.add(label4);
p2.add(cl);
p2.add(bttnSearch);
p1.add(label1);
p1.add(l5);
p1.add(cd);
p1.add(bttnSelect);
p1.add(bttnCancel);
//p3.add(p4);
p2.add(p3);
p1.add(p2);
cont.add(p1);
newFrame.add(p1);
//setSize(700,300);
newFrame.setVisible(true);
newFrame.setLocationRelativeTo(null);
//newFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent ae)
{
s2 = (String)cd.getSelectedItem();
if(ae.getActionCommand() == "Show")
{
if(s2=="ID")
Page | 37
{
label3.setVisible(false);
txtname.setVisible(false);
label4.setVisible(false);
cl.setVisible(false);
p3.setVisible(false);
label2.setVisible(true);
ct.setVisible(true);
p2.setVisible(true);
}
else
{
label2.setVisible(false);
ct.setVisible(false);
p3.setVisible(false);
//txtname.setText("");
label3.setVisible(true);
txtname.setVisible(true);
label4.setVisible(true);
cl.setVisible(true);
p2.setVisible(true);
}
}
if(ae.getActionCommand() == "Search!")
{
if(s2=="ID")
{
String ss=(String)ct.getSelectedItem();
int search=Integer.parseInt(ss);
//String[] colHeads;
//Statement st;
//ResultSet rs;
//int i;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:sss");
st=con.createStatement();
rs=st.executeQuery("select * from Details where Id="+search+"");
ResultSetMetaData md;
int n=0;
int count=1;
while(rs.next())
{
n++;
count++;
}
md=rs.getMetaData();
int c=md.getColumnCount();
colHeads=new String[c];
for(i=0;i<c;i++)
Page | 38
{
colHeads[i]=md.getColumnLabel(i+1);
}
data=new Object[n][c];
int r=0;
rs.close();
rs=st.executeQuery("select * from Details where Id="+search+"");
while(rs.next())
{
for(i=0;i<c;i++)
{
data[r][i]=rs.getString(i+1);
}
r++;
}
d = new DefaultTableModel();
d.setDataVector(data,colHeads);
searchTable.setModel(d);
p3.setVisible(true);
}
catch(Exception s)
{
s.printStackTrace();
}
}
else
{
String sclass=cl.getSelectedItem().toString();
if(txtname.getText()!=null && sclass!=null)
{
String sch=txtname.getText().toString();
//String[] colHeads;
//Statement st;
//ResultSet rs;
//int i;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:sss");
st=con.createStatement();
rs=st.executeQuery("select * from Details where Name='"+sch+"' and Class='"+sclass+"'");
if (rs.next())
{
ResultSetMetaData md;
int n=0;
int count=1;
while(rs.next())
{
n++;
count++;
}
md=rs.getMetaData();
int c=md.getColumnCount();
Page | 39
colHeads=new String[c];
for(i=0;i<c;i++)
{
colHeads[i]=md.getColumnLabel(i+1);
}
data=new Object[count][(c+1)];
int r=0;
rs.close();
rs=st.executeQuery("select * from Details where Name='"+sch+"' and Class='"+sclass+"'");
while(rs.next())
{
for(i=0;i<c;i++)
{
data[r][i]=rs.getString(i+1);
}
r++;
}
d = new DefaultTableModel();
d.setDataVector(data,colHeads);
searchTable.setModel(d);
p3.setVisible(true);
}
else
{
p3.setVisible(false);
JOptionPane.showMessageDialog(this," **Records For The Requested Information Not
Present**","Search Falied",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception s)
{
s.printStackTrace();
}
}
//if(txtname.getText()==null)
else
{
JOptionPane.showMessageDialog(this," ** Enter Name **","SearchFalied"
,JOptionPane.ERROR_MESSAGE);
}
}
}
if(ae.getSource() == bttnCancel)
{
ICardGeneration.s=0;
newFrame.dispose();
}
}
public static void main(String[] args)
{
Page | 40
new srch();
}
}
View All:
Page | 41
CODING
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.tree.*;
import javax.swing.table.*;
class viewall extends JFrame implements ActionListener
{
JFrame newFrame;
JTable searchTable;
JPanel p1,p2,p3;
JLabel label1;
JButton btview, btCancel;
JScrollPane scrollPane;
Object[][] data;
Container cont;
DefaultTableModel d;
viewall()
{
newFrame = new JFrame("View All");
newFrame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
newFrame.setSize(600,700);
newFrame.setResizable(false);
p1 = new JPanel();
p2 = new JPanel();
p3 = new JPanel();
p1.setLayout(null);
label1 = new JLabel("Click to View All The Records");
btview = new JButton("View");
btview.addActionListener(this);
btCancel = new JButton("Cancel");
btCancel.addActionListener(this);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
searchTable=new JTable(20,10);
scrollPane=new JScrollPane(searchTable,v,h);
p3.setVisible(false);
Page | 42
p1.add(label1);
p2.add(btview);
p2.add(btCancel);
label1.setBounds(220,0,500,50);
p2.setBounds(0,40,600,500);
p3.setBounds(10,80,600,600);
cont=getContentPane();
p3.add(scrollPane);
p2.add(p3);
p1.add(p2);
cont.add(p1);
newFrame.add(p1);
setSize(700,220);
newFrame.setVisible(true);
newFrame.setLocationRelativeTo(null);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getActionCommand() == "View")
{
String[] colHeads;
Statement st;
ResultSet rs;
int i;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:sss");
st=con.createStatement();
rs=st.executeQuery("select * from Details");
ResultSetMetaData md;
int n=0;
int count=1;
while(rs.next())
{
n++;
count++;
}
md=rs.getMetaData();
int c=md.getColumnCount();
colHeads=new String[c];
for(i=0;i<c;i++)
{
colHeads[i]=md.getColumnLabel(i+1);
}
data=new Object[n][c];
int r=0;
rs.close();
rs=st.executeQuery("select * from Details");
while(rs.next())
{
for(i=0;i<c;i++)
{
data[r][i]=rs.getString(i+1);
}
Page | 43
r++;
}
d = new DefaultTableModel();
d.setDataVector(data,colHeads);
searchTable.setModel(d);
p3.setVisible(true);
}
catch(Exception s)
{
s.printStackTrace();
}
}
if(ae.getActionCommand() == "Cancel")
{
ICardGeneration.v=0;
newFrame.dispose();
}
}
public static void main(String[] args)
{
new viewall();
}
}
Page | 44
Update:
Page | 45
Coding:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JOptionPane;
import java.sql.*;
import java.util.Date;
import java.text.*;
Page | 46
Updt()
{
setTitle("Student Entry Modify");
img = new ImageIcon("mats_3.jpg");
p1 = new JPanel()
{
protected void paintComponent(Graphics g)
{
g.drawImage(img.getImage(), 0, 0, null);
super.paintComponent(g);
}
};
p1.setOpaque( false );
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
p1.setLayout(null);
image.setBorder(BorderFactory.createLineBorder(Color.black));
I=new JComboBox();
I.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
I.setForeground(Color.blue);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:sss");
Page | 47
st=con.createStatement();
rs=st.executeQuery("select Id from Details order by Id
ASC");
while(rs.next())
{
I.addItem(rs.getString(1));
}
rs.close();
}
catch (Exception n)
{
n.printStackTrace();
}
nt = new JTextField(18);
nt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
nt.setForeground(Color.blue);
ct=new JComboBox();
ct.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
ct.setForeground(Color.blue);
ct.addItem("MCA");
ct.addItem("MBA");
ct.addItem("BCA");
ct.addItem("PGDCA");
ct.addItem("B.COM");
ct.addItem("BBA");
ct.addItem("B.SC");
ct.addItem("BE");
se=new JComboBox();
se.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
se.setForeground(Color.blue);
se.addItem("Male");
se.addItem("Female");
bt=new JComboBox();
bt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
bt.setForeground(Color.blue);
bt.addItem("O+");
bt.addItem("A+");
bt.addItem("A-");
bt.addItem("B+");
bt.addItem("B-");
Page | 48
bt.addItem("AB+");
bt.addItem("AB-");
mt = new JTextField(18);
mt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
mt.setForeground(Color.blue);
//dt = new JTextField(18);
//dt.setFont(new Font("Footlight MT Light",Font.ITALIC,15));
//dt.setForeground(Color.blue);
nt.addKeyListener(new KeyAdapter()
{
public void keyTyped(KeyEvent v)
{
char c = v.getKeyChar();
if (!((c >= 'a'|| c >= 'A') && (c <= 'z' || c <= 'Z') || (c ==
KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_SPACE) || (c ==
KeyEvent.VK_DELETE)))
{
getToolkit().beep();
v.consume();
}
}
});
mt.addKeyListener(new KeyAdapter()
{
public void keyTyped(KeyEvent e)
{
char c = e.getKeyChar();
if (!((c >= '0') && (c <= '9') &&
(mt.getText().length()<=9)|| (c == KeyEvent.VK_BACK_SPACE) || (c ==
KeyEvent.VK_DELETE)))
{
getToolkit().beep();
e.consume();
}
}
});
go.addActionListener(this);
update.addActionListener(this);
cancel.addActionListener(this);
browse.addActionListener(this);
Page | 49
mats.setBounds(180,20,150,30);
Id.setBounds(70,70,198,20);
I.setBounds(260,70,90,20);
go.setBounds(360,70,80,20);
image.setBounds(200,130,80,100);
browse.setBounds(290,170,80,20);
name.setBounds(70,260,198,20);
nt.setBounds(260,260,190,20);
//dob.setBounds(70,290,198,20);
//dt.setBounds(260,290,190,20);
mob.setBounds(70,290,198,20);
mt.setBounds(260,290,190,20);
cls.setBounds(70,320,198,20);
ct.setBounds(260,320,190,20);
bg.setBounds(70,350,198,20);
bt.setBounds(260,350,190,20);
sx.setBounds(70,380,198,20);
se.setBounds(260,380,90,20);
update.setBounds(150,430,80,20);
cancel.setBounds(250,430,80,20);
cont = getContentPane();
p1.add(mats);
p1.add(image);
p1.add(browse);
p1.add(Id);
p1.add(I);
p1.add(go);
p1.add(name);
p1.add(nt);
//p1.add(dob);
//p1.add(dt);
p1.add(mob);
p1.add(mt);
p1.add(cls);
p1.add(ct);
p1.add(bg);
p1.add(bt);
p1.add(sx);
p1.add(se);
p1.add(update);
p1.add(cancel);
Page | 50
cont.add(p1);
setVisible(true);
setSize(500,540);
setLocationRelativeTo(null);
}
cla=(String)ct.getSelectedItem().toString();
sex=(String)se.getSelectedItem().toString();
if(e.getSource()==cancel)
{
ICardGeneration.u=0;
dispose();
}
if(e.getSource()==go)
{
Search();
}
if(e.getSource()==browse)
{
chooser = new JFileChooser();
chooser.showOpenDialog(null);
file=chooser.getSelectedFile().getPath();
icon = new ImageIcon(file);
image.setIcon(icon);
}
if(e.getSource()==update)
{
if(nt.getText().length()==0)
{
JOptionPane.showMessageDialog(p1,"Please Enter
Your : :"+name.getText());
}
if(mt.getText().length()==0)
{
Page | 51
JOptionPane.showMessageDialog(p1,"Please Enter
Your : :"+mob.getText());
}
//if(dt.getText().length()==0)
//{
// JOptionPane.showMessageDialog(p1,"Please Enter
Your : :"+dob.getText());
//}
if (((nt.getText().length()!=0)&&(mt.getText().length()!
=0)/*&&(dt.getText().length()!=0)*/))
{
Modify();
}
}
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:sss");
Statement st=con.createStatement();
st.execute("Select * from Details where Id="+ID_N+"");
ResultSet rs=st.getResultSet();
while(rs.next())
{
nt.setText(rs.getString(2));
String ct_1 = rs.getString(3);
String bt_1 = rs.getString(4);
String se_1 = rs.getString(5);
//dt.setText(rs.getString(6));
mt.setText(rs.getString(7));
file=rs.getString(10);
image.setIcon(new ImageIcon(file));
ct.setSelectedItem(ct_1);
Page | 52
bt.setSelectedItem(bt_1);
se.setSelectedItem(se_1);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:sss");
String sql="Update Details" + "set Name='"+stu_name+"',
class='"+Modifing+"', BG='"+Mod+"', Sex='"+Modi+"',MOB='"+mob_no+"',
image='"+file+"' where Id='"+ID_N+"'";
Statement st=con.createStatement();
int cou=st.executeUpdate(sql);
System.out.println(cou);
if(cou>0)
{
JOptionPane.showMessageDialog(p1," ** Record
Succesfully Updated ** ","Update
Information",JOptionPane.INFORMATION_MESSAGE);
return;
}
else
{
Page | 53
JOptionPane.showMessageDialog(p1,"** Updation
Failed **","Error",JOptionPane.ERROR_MESSAGE);
st.close();
con.close();
return;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
Page | 54
Conclusion:
The Student ID Card Generation System, developed using Java and
Access, fully meets the objectives of the system for which it has been
developed. The system has reached a steady state where all bugs have been
eliminated. The system is operated at a high level of efficiency and all the
members and employees associated with the system understand its advantage.
The system solves the problem. It was intended to solve as requirement
specification.
Limitations
Future Scope
This can be used for Generating Staff Id cards.
Can be used anywhere in the university for any purpose.
More security can be provided.
Report can also be generated.
Bibliography
Complete Reference of Java.
Black book 2005
www.roseindia.org
www.java.net
www.google.com
Page | 55