You are on page 1of 55

INTRODUCTION

The Student Identity Card System is a photo identification card that


identifies the holder as a full-time student. It is currently a form of identification
that is used by many Universities and colleges.

Cardholders gain access to facilities provided by the university or college


like library facility and other facilities provided. The card is issued by the
University or college management, In Universities and colleges the possession
of identity card is compulsory. It issued in the form of a small, mostly standard-
sized card, it is usually called an identity card (IC).

Page | 1
SOFTWARE AND HARDWARE REQUIREMENTS

Hardware Specifications:

The following are the minimal hardware requirements to execute this project

 Intel P-4 Processor and above


 64 MB RAM
 1GB Hard Disc

Software Specifications:

The following are the minimal software requirements to execute this project

Operating System : Windows XP and above

Language : JAVA

Frontend : Swing

Backend : MS- Access

We will be using Java Database Connectivity tool (JDBC) to connect to


database.

Page | 2
Platform Used

Introduction to Java

Java is a general – purpose, object- oriented programming language


developed by Sun Microsystems of USA in 1991. Originally developed by
James Gosling, one of the inventor of the language.

Java Features

 Compiled and Interpreted


 Platform- Independent and Portable
 Object- oriented
 Robust and Secure
 Distributed
 Multithreaded and Interactive

Java Development Kit

 Appletviewer
 Javac
 Java
 Javap

Application Programming Interface

 Language Support Package


 Utilities Package
 Input/output Package
 Networking Package
 AWT Package
 Applet Package

Page | 3
Synopsis

Purpose :

The purpose of developing Identity Card Generation system is to


computerized the tradition way of generating Identity Card. Another purpose for
developing this software is to make manual effort less i.e. the project is
developed as a desktop application and it will work for a particular institute. But
later on the project can be modified to operate it online. Therefore with regard
to this project, the main aim is to generate Identity Card computerized because
it’s very easy as compared to manually. This software will make the whole
working of system by representing the record in very friendly manner and will
avoid the ambiguity of the record as well.

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

 It can run on any windows operating system


 It requires only Java and access
 There is no need to add extra hardware and software to use
this software

That’s why it’s a technically feasible system

Economic feasible

 As the software and hardware are in affordable range

That’s why it is economically feasible

Flaws in the system

 Due to lack of time supplementary and super supplementary


records are not maintained

Page | 5
System Study

A detailed study of the existing system is necessary. The functions of the


system, requirements for the users, structure of the current system is made
through the system study. The problems faced in the current system are found
and solution pertaining to it is done in the 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...

In this process very difficult to maintain the complete details of student in


proper way. They have to maintain the file, documentation, reports (class Wise,
section wise) etc.

Page | 6
Need For Proposed System

The main objective of the existing system is to provide a user-friendly


interface. The system, which is proposed, now computerizes all the details that
are maintained manually. Once the details are fed into the computer there is no
need for various persons to deal with separate sections. Only a single person is
enough to maintain all the reports. The security can also be given as per the
requirement of the user.

 Large volumes of data can be stored with case.

 Maintenance of file is flexible.

 Records stored are updated now and then.

 Stored data and procedures can be easily edited.

 Reports can be generated with case.

 Accurate calculations are made.

 Less manpower required.

Objective Of The Project

Main aim in developing Identity Card Generation system is to provide an


easy way not only to automate all functionalities of a college, but also to
provide full functional reports to top management of college with the finest of
details about any aspect of student.

We are committed to bring the best way of management in the various


forms of management system. Its main purpose is to serve as a bridge between
the College and Students. So we can say the Core purpose of designing

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.

Scope Of The System

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

Login form Update

View All

ID CARD GENERATION SYSTEM


ADD NEW
Search
By Id DETAILS

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);
}

public void actionPerformed(ActionEvent ae)

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.*;

class ICardGeneration implements ActionListener


{
JPanel topPanel,bottomPanel, centerPanel;
JScrollPane scrollPane;
JFrame frame;
ImageIcon icon;

JMenuBar menubar = new JMenuBar(); ;


JMenu menu = new JMenu();
JMenuItem menuItem;

Toolkit kit = Toolkit.getDefaultToolkit();


Dimension screenSize = kit.getScreenSize();
int screenHeight = screenSize.height;
int screenWidth = screenSize.width;

Image img = kit.getImage("mats.JPG");


static int i=0,s=0,v=0,u=0;

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);

menuItem = new JMenuItem("Update");


menu.add(menuItem);
menuItem.addActionListener(this);
menubar.add(menu);

menuItem = new JMenuItem("Search");


menu.add(menuItem);
menuItem.addActionListener(this);

menuItem = new JMenuItem("View All");


menu.add(menuItem);
menuItem.addActionListener(this);

menu = new JMenu("Help");


menuItem = new JMenuItem("About");
menu.add(menuItem);
menuItem.addActionListener(this);
menubar.add(menu);
frame.setJMenuBar(menubar);

icon = new ImageIcon("mats_2.jpg");


JPanel topPanel = new JPanel();
JPanel centerPanel = new JPanel()
{
protected void paintComponent(Graphics g)
{
g.drawImage(icon.getImage(), 275, 50, null);
super.paintComponent(g);
}
};
centerPanel.setOpaque( false );
JPanel bottomPanel = new JPanel();

//Add Buttons To Bottom Panel

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");

//Add Action Listeners


AddNew.addActionListener(this);
Search.addActionListener(this);
Update.addActionListener(this);
ViewList.addActionListener(this);

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);
}

public static void main(String args[])


{
new ICardGeneration();
}

OperationHandler oh = new OperationHandler();

public void actionPerformed(ActionEvent ae)


{

if(ae.getActionCommand() == "Add New")


{
if(i==0)
{
new ICard();
i=1;
Page | 24
}
}
else if(ae.getActionCommand() == "Search")
{
if(s==0)
{
new srch();
s=1;
}
}

else if(ae.getActionCommand() == "View All")


{
if(v==0)
{
new viewall();
v=1;
}
}
else if(ae.getActionCommand() == "About")
{
JOptionPane.showMessageDialog(frame, "ID Card
Generation System Developed By Mandeep Singh Chawla and Bhavdeep Singh
Dua","About ID Card Generation System",
JOptionPane.INFORMATION_MESSAGE);
}

else if(ae.getActionCommand() == "Update")


{
if(u==0)
{
new Updt();
u=1;
}
}
}
}

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.*;

class ICard extends JFrame implements ActionListener


{
JLabel name, cls, bg, mob, mats, image, dob, validup, dat, autho, sx, sign;
JTextField nt, mt, dt, vt, datt;
JComboBox bt,ct,se;
JButton insert,cancel,browse,brow;
JRadioButton m,f;
ButtonGroup group;
JPanel p1,p2,p3;
JFrame frame;
Connection con;
Statement s;
String file, ID_n;
ImageIcon icon, img, si;
Container cont;
JFileChooser chooser;

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");

mats = new JLabel("MATS University", JLabel.CENTER);


mats.setFont(new Font("Times New Roman", Font.BOLD, 18));
name = new JLabel("Name");
cls = new JLabel("Class");
bg = new JLabel("Blood Group");
sx = new JLabel("Sex");
mob = new JLabel("Mobile No.");
image = new JLabel(" ");
sign = new JLabel(" ");
dob = new JLabel("Date of Birth");
validup = new JLabel("Valid upto");
autho = new JLabel("Authorized Signatory");
dat = new JLabel("Issue Date");

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);

Date now = new Date();


DateFormat df1 = DateFormat.getDateInstance(DateFormat.SHORT);
String d = (df1.format(now));
String d1 = d.substring(5);
int n = Integer.parseInt(d1);
n = n + 6;
String d2 = Integer.toString(n);
String d3 = d.replace(d1,d2);

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);
}

public void actionPerformed(ActionEvent e)


{
chooser = new JFileChooser();
if(e.getSource()==browse)
{
chooser.showOpenDialog(null);
file=chooser.getSelectedFile().getPath();
System.out.println(file);
icon = new ImageIcon(file);
image.setIcon(icon);
}
if (e.getSource()==insert)
{
String s1 = nt.getText();
String s2 = (String)ct.getSelectedItem();
String s3 = (String)bt.getSelectedItem();
String s4;
String s5 = dt.getText();
String s6 = mt.getText();
String s7 = vt.getText();
String s8 = datt.getText();

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();
}
}

public static void main(String agr[])


{
new ICard();
}
}

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.*;

class Updt extends JFrame implements ActionListener


{
JLabel name, cls, bg, mob, mats, dob, sx, Id, image;
JTextField nt, mt, dt;
JComboBox bt, ct, se, I;
JButton update, cancel, go, browse;
JPanel p1;
JFrame frame;
Connection con;
Statement s;
String search, cla, sex, file;
ImageIcon img, icon;
Container cont;
Statement st;
ResultSet rs;
int ID_N;
JFileChooser chooser;

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);

update = new JButton("Update");


cancel = new JButton("Cancel");
browse=new JButton("Browse");
go = new JButton("GO");

Id = new JLabel("Select ID");


mats = new JLabel("MATS University", JLabel.CENTER);
mats.setFont(new Font("Times New Roman", Font.BOLD, 18));
name = new JLabel("Name");
cls = new JLabel("Class");
bg = new JLabel("Blood Group");
sx = new JLabel("Sex");
mob = new JLabel("Mobile No.");
image = new JLabel(" ");
//dob = new JLabel("Date of Birth");

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);
}

public void actionPerformed(ActionEvent e)


{

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();
}
}
}

public void Search()


{
search=(String)I.getSelectedItem();
ID_N=Integer.parseInt(search);

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();
}

public void Modify()


{
String Modifing = ct.getSelectedItem().toString();
String Mod = bt.getSelectedItem().toString();
String Modi = se.getSelectedItem().toString();
String B_date = dt.getText();
String mob_no = mt.getText();
int mo = Integer.parseInt(mob_no);
String stu_name = nt.getText();

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();
}
}

public static void main(String[] args)


{
new Updt();
}
}

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

 The Report cannot be generated.


 Lack of Security in ID card generation.

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

You might also like