Professional Documents
Culture Documents
ON
Submitted To:
TABLE OF CONTENTS
S. No.
SECTION NAME
1.
Acknowledgement
2.
Training Certificate
3.
Candidate Declaration
4.
Abstract
5.
Introduction to Project
6.
7.
8.
Tools/Platform Used
9.
Output/Screenshots
10.
Conclusion
ACKNOWLEDGEMENT
I am really grateful to DR. D.P Gupta, Principal HCTM Technical Campus, Kaithal for
providing this opportunity to carry out the project.
I am highly grateful to the Er. Sunil Kaushik, HEAD OF DEPARTMENT, HCTM
Technical Campus, Kaithal for providing this opportunity to carry out the project.
The constant guidance and encouragement received from Mr. Munish Technical Head at
A2IT Chandigarh have been of great help in carrying our work and is acknowledged with
reverential thanks. Without the wise counsel and able guidance, it would have been
impossible to complete the project in this manner.
I express gratitude to other faculty members of Computer Science Department, HCTM
Kaithal for their intellectual support throughout the course of this work.
CANDIDATE DECLARATION
I hereby certify that the present training report being submitted by me entitled LIBRARY
is
an
authentic
record
of
the
course
for
the
session
2013-2016
Signature of Student
Baljeet Saini(1712212)
ABSTRACT
Student information system is a project that provides desktop application for teacher and
students. Students will be able to access their personnel information , scheme record and
can also view message from admin their for each semester. By using this Information
system teacher will be able to keep record of personnel information , attendance and
sessional record for every student. These three modules are further subdivided in sub
modules according to there role in the institution. Administrator Module: Basically
administrator role is to create and maintain user accounts, students personnel information
as well as academic record of every semester and scheme record. To fulfill these
requirements Administrator module has three sub modules. User Account : This module
will create user accounts. Accounts will be created on the basis of information available
in the database.
Personnel information: This module will add and view and students records. Students
record has to be entered into the database with specified information of the students. Then
accordingly accounts will be created by the administrator.
sessional scheme: This module will add and view scheme records. At the beginning of
new semester administrator has to enter the sessional marks in the database with all the
subject details.
1. Administration Module:
Admin Login:- It consists of mainly two fields AdminName& Password.These
will store in the table which we maintain in the database.
Admin Home:- It mainly uses to watch all the records of users as well as Teacher.
Add New User Details:- It mainly Consists of the personnel information of
a student. In this Admin will fill all the persoinnel details of user.
A New User Registration:- It consisits of three fields NewUserName,Pass
Word and ConfirmPassword.
View Academic Record:- By this Admin will view all the details of a the
Registered user.
.
View Personnel Information by Name:- By this Admin will view all the
Personnel Information by only type the name of a student.
View Personnel Information by Rollno:-By this Admin will view all the
Personnel Information by only type the Rollno of a student.
View Info of Registered Users:- By this the Admin will view all the info
View all the academic record:- By this the Admin will view all the
Academic record of all the registered users.
Send Message to Users:- By this Admin can send the message to all the
Registered users.
2. User Module:
User Login:- By this User will Login by filling the Password & Username.
User Home:- By this the user can
Enter Marks of Qualification:- By this the User can enter the whole
Information about all the qualifications.
View Personnel info by Rollno:- By this the User will also view his/
her Personnel info entered by Admin.
View Message From Admin:- By this user can view the message sen
d by Admin.
SOFTWARE REQUIREMENT
Backend:- Ms Access
jdk 1.6
Interpreter:- JVM
HARDWARE REQUIREMENT
Color Monitor
Keyboard
Mouse
7..256 mb RAM
For the fulfillment of this project we are using Java Swings as Front End and Ms Access
for centralized database as Back End and Java work as live wire between these two in this
project. In this project we are using core java programs. Structure used to develop this
project is one of the best, secure and popular model view controller structure for desktop
applications.
Designing of project will be done on the basis of CORE JAVA According to the design of
the project coding will be done for both front and backend, and then the integration of
project will be done on client-server platform.
Front is that end of the software which is visible to user. User has to simply operate it
according to the instruction provided by programmer. As a front end Notepad is used.
Backend deals with the database handling of the project according to the user
requirement, this end is not visible to the application user. Ms access is used for the
database.
Working of Java
As with many other programming languages, Java uses a compiler to convert humanreadable source code into executable programs. Java compiler generates
architecture-independent byte codes. The byte codes can be only a Java
virtual machine, which is an ideal Java architecture, usually implemented
in software rather than hardware. The compilation process is illustrated
as under.
Java Source
Code
Java Compiler
Java
Byte codes
fig 5.1
Java Features
The major characteristics that make Java such powerful development tool are its security,
open standards, memory management, object oriented, multithreading and its distributed
and dynamic characteristics.
1.Simple
Java was designed to be the easy for professional programmer to learn and use
effectively. If one already understands the basic concepts of object oriented
programming, learning Java will be even easier.
2.Robustness
The multiplatformed environment of the Web places extraordinary demand on a program,
because the program must execute reliably in a verity of systems. Thus the ability to
create robust programs was given a priority in the design of Java. To better understand
how Java is robust, consider two of the reasons for program failure, memory management
mistakes and mishandled exception conditions (i.e. run time error). Memory management
can be difficult, tedious task in traditional programming environments. For example in
C/C++, the programmer must manually allocate and free all dynamic memory. This
sometimes lead to problems, because programmer will either forgot to free memory that
has been previously allocated or, worse, try to free some memory that another part of
their code is still using. Java virtually eliminates these problems by managing memory
allocation and deallocation, because java provides for you. Exceptional conditions in
traditional environments often arises in a situation such as division by zero or file not
found and thy must be managed with clumsy and hard-to-hard construct. Java helps in
this area by providing object oriented exception handling. In well written Java programs,
all run-time errors can and be managed by your program.
3.Security Features
Security is probably the main problem facing Internet developers. Users are typically
afraid of two things: confidential information being compromised and their computer
systems being corrupted or destroyed by hackers. Javas built in security addresses both
of these concerns. Java built-in security measures ensure java programs will operates
with in the rules of the VM & prevent untrustworthy programs from accessing system
resources.
6.Object-Oriented
Object Oriented Programming (OOP) is a way to software that is reusable, extensible &
maintainable. Java is an object-oriented language that is it has facilities for OOP
incorporated into the language.
Processor: Pentium IV
PENTIUM IV is most widely used processor now a day. Its speed is quite fast, and the
maintenance and servicing is also easy. Most of the programs can efficiently work on this
processor; mainly the back-end Access and the front-end notepad.
Pentium 4 is a line of single-core desktop and laptop central processing units (CPUs) and
it was introduced by Intel on November 20, 2000[1] and shipped through August 8, 2008.
[2]
They had a 7th-generation x86 microarchitecture, called NetBurst, which was the
The first Pentium 4 cores, codenamed Willamette, were clocked from 1.3 GHz to 2 GHz.
They were released on November 20, 2000, using theSocket 423 system. Notable with
the introduction of the Pentium 4 was the 400 MT/s FSB. It actually operated at 100 MHz
but the FSB was quad-pumped, meaning that the maximum transfer rate was four times
the base clock of the bus, so it was marketed to run at 400 MHz. The AMD Athlon's
double-pumped FSB was running at 100 or 133 MHz (200 or 266 MT/s) at that time.
Pentium
CPUs
introduced
in
the
Prescott-based
Pentium
TOOLS/PLATFORM USED
The Java Programming Language
The Java programming language is a high-level language that can be characterized by all
of the following buzzwords:
Simple
Object oriented
Distributed
Interpreted
Robust
Secure
Architecture neutral
Portable
High performance
Multithreaded
With most programming languages, you either compile or interpret a program so that you
can run it on your computer. The Java programming language is unusual in that a
program is both compiled and interpreted. With the compiler, first you translate a
program into an intermediate language called
The interpreter parses and runs each Java bytecode instruction on the computer.
Compilation happens just once; interpretation occurs each time the program is executed.
The following figure illustrates how this works.
You can think of Java bytecodes as the machine code instructions for the Java Virtual
Machine (Java VM). Every Java interpreter, whether it's a development tool or a Web
browser that can run applets, is an implementation of the Java VM.
Java bytecodes help make "write once, run anywhere" possible. You can compile your
program into bytecodes on any platform that has a Java compiler. The bytecodes can then
be run on any implementation of the Java VM. That means that as long as a computer has
a Java VM, the same program written in the language can run on Windows 2000, a
Solaris workstation.
You've already been introduced to the Java VM. It's the base for the Java platform and is
ported onto various hardware-based platforms. The Java API is a large collection of
ready-made software components that provide many useful capabilities, such as graphical
user interface (GUI) widgets. The Java API is grouped into libraries of related classes and
interfaces; these libraries are known as Packages. The next section highlights what
functionality some of the packages in the Java API provide.
The following figure depicts a program that's running on the Java platform. As the figure
shows, the Java API and the virtual machine insulate the program from the hardware.
Native code is code that after you compile it, the compiled code runs on a specific
hardware platform. As a platform-independent environment, the Java platform can be a
bit slower than native code. However, smart compilers, well-tuned interpreters, and justin-time bytecode compilers can bring performance close to that of native code without
threatening portability.
However, the Java programming language is not just for writing cute, entertaining applets
for the Web. The general-purpose, high-level Java programming language is also a
powerful software platform. Using the generous API, you can write many types of
programs.
An application is a standalone program that runs directly on the Java platform. A special
kind of application known as a server serves and supports clients on a network. Examples
of servers are Web servers, proxy servers, mail servers, and print servers. Another
specialized program is a servlet. A servlet can almost be thought of as an applet that runs
on the server side. Java Servlets are a popular choice for building interactive web
applications, replacing the use of CGI scripts. Servlets are similar to applets in that they
are runtime extensions of applications. Instead of working in browsers, though, servlets
run within Java Web servers, configuring or tailoring the server.
How does the API support all these kinds of programs? It does so with packages of
software components that provides a wide range of functionality. Every full
implementation of the Java platform gives you the following features:
The essentials: Objects, strings, threads, numbers, input and output, data
structures, system properties, date and time, and so on.
Security: Both low level and high level, including electronic signatures,
public and private key management, access control, and certificates.
Avoid platform dependencies with 100% Pure Java: You can keep your
program portable by avoiding the use of libraries written in other
languages. The 100% pure JAVA is a repository of historical process
manuals, white papers, brochures, and similar materials online.
Write once, run anywhere: Because 100% Pure Java programs are
compiled into machine-independent bytecodes, they run consistently on
any Java platform.
Distribute software more easily: You can upgrade applets easily from a
central server. Applets take advantage of the feature of allowing new
classes to be loaded "on the fly," without recompiling the entire program.
JDBC:
Setting up a Database
First we will show you how to open a connection with your DBMS, and then, since
what JDBC does is to send your SQL code to your DBMS, we will demonstrate some
SQL code. After that, we will show you how easy it is to use JDBC to pass these SQL
statements to your DBMS and process the results that are returned.
This code has been tested on most of the major DBMS products. However, you
may encounter some compatibility problems using it with older ODBC drivers
with the JDBC-ODBC Bridge.
Establishing a Connection
The first thing you need to do is establish a connection with the DBMS you want
to use. This involves two steps: (1) loading the driver and (2) making the
connection.
Loading Drivers
Loading the driver or drivers you want to use is very simple and involves just one
line of code. If, for example, you want to use the JDBC-ODBC Bridge driver, the
following code will load it:
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
If you were to create your own instance, you would be creating an unnecessary
duplicate, but it would do no harm.
When you have loaded a driver, it is available for making a connection with a
DBMS.
This step is also simple, with the hardest thing being what to supply for url . If
you are using the JDBC-ODBC Bridge driver, the JDBC URL will start with jdbc:
odbc. The rest of the URL is generally your data source name or database system.
The driver documentation will also give you guidelines for the rest of the JDBC
URL. This last part of the JDBC URL supplies information for identifying the
data source.
If one of the drivers you loaded recognizes the JDBC URL supplied to the method
DriverManager.getConnection, that driver will establish a connection to the
DBMS specified in the JDBC URL. The Driver Manager class, true to its name,
manages all of the details of establishing the connection for you behind the
scenes. Unless you are writing a driver, you will probably never use any of the
methods in the interface Driver , and the only Driver Manager method you really
need to know is DriverManager.getConnection .
The connection returned by the method DriverManager.getConnection is an open
connection you can use to create JDBC statements that pass your SQL statements
to the DBMS. In the previous example, con is an open connection and we will use
it in the examples that follow
Executing Statements
We used the method execute Update because the SQL statement contained in
createTableCoffees is a DDL (data definition language) statement. Statements that
create a table, alter a table, or drop a table are all examples of DDL statements
and are executed with the method execute Update . As you might expect from its
name, the method execute Update is also used to execute SQL statements that
update a table. In practice, execute Update is used far more often to update tables
than it is to create them because a table is created once but may be updated many
times.
The method used most often for executing SQL statements is execute Query. This
method is used to execute SELECT statements, which comprise the vast majority
of SQL statements. You will see how to use this method shortly.
PACKAGES:
Packages are containers for classes that are used to keep the class name space
compartmentalized. To create a package, simply include a PACKAGE command as
the first statement in java source file. Any class defined within that file will belong to
that specified package.
The different packages used in the project are:
AWT PACKAGE:
The abstract window tools (awt) package consists of the AWT classes.
There are many AWT classes some of them which are relevant here are named
below:
Menubar class
Menu class
Font class
Panel class
SWING PACKAGE:
There are many packages used by swing, the main package is JAVAX.SWING
.it contains the classes that implement the basic swing component such as
Push buttons
labels
Checkboxes etc.
One other package used is JAVAX.SWING.EVENT.
SQL PACKAGE:
Methods in the classes of this package are used for the connectivity with the
database. Some of the classes of this package are:
Connection class
Drivermanager class etc.
INTERFACES:
The interfaces provide multibase inheritance; an interface will consist of the
following:
VARIABLES:
These variables are by default FINAL.
FUNCTIONS:
The functions in the interface are ABSTRACT i.e. they are only declared in an
interface and are overridden by the classes implementing the interface.
SCOPE OF FUNCTIONS:
The scope of functions declared in an interface is by default PUBLIC and
ABSTRACT.
ACTION LISTENER:
This interface defines the actionPerformed () method that is invoked when an
action event occurs. we use the methods of the ActionEvent class to handle the
various event sources.namely:getActionCommand().
ITEM LISTENER:
This interface defines the itemStateChanged () method that is invoked when the
state of an item is changed. We use the methods of ItemEvent
Class to handle the various event sources.namely: getItem () and getSource () and
getStateChanged ().
Packages Imported:
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import java.sql.*;
Interfaces Implemented:
ActionListener
ItemListener
SWINGS:
To create a graphical user interface java provides us with applets and swings.
The swing components provide rich functionality and allow a high level of
customization. The purpose of this overview is to give you a feel for the
capabilities of the swing component set.
The various swing component classes used here are:
JLABEL:
It creates a label. It can be used to display a text or an icon.
JBUTTON:
The jbutton class provides functionality of a push button. Jbutton allows an icon,
a string or both to be associated with push buttons.
JTEXTFIELD:
It allows you to edit one line of text. It generates events in response to user
interaction.
JTABLE:
It is component that displays rows and columns of data. You can drag the cursor
on the column boundaries to resize the column.
JTABBEDPANE:
It manages a set of components by linking them with tabs. Selecting a tab causes a
component associated with the tab to come to the fore front.
OUTPUT/SCREENSHOTS
When we start the Project we will find two modules One is User Module,Second is the
Admin Module.
On Clicking on Admin Frame, Admin Login frame opens and by entering the
username and password Admin can Login to Admin Home.
By this frame Admin will enter the personnel information of registered user.
By this frame Admin can view the personnel info of registered user by rollno.
By this frame Admin can view the personnel info of registered user by name.
By this Admin will view all the user Academic record of a user.
By this Admin will view the personnel information of all the registered users.
By this Frame Registered User can login to User home by entering the Username and
Password.
By this Frame User can view the public message sent by Admin.
Database Screenshots
Admin Login: This table contains two field name one is admin name and other is the
paasword.
City,State,Mob no.
User Login: This table contains two field names one is Name and other is Password.
Enter Marks: This table contains Fourteen field names Name,Roll no,Stream,Tenth
Per,Twelth Per,Diploma Per,Btech First Supply,Btech First Per, Btech Second
Supply,Btech Second Per, Btech Third Supply,Btech Third Per, Btech Fourth Supply,Btech
Fourth Per.
Coding:-
package Layouts;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import listners.AdminBookListener;
import listners.AdminChangePasswordListener;
import listners.AdminStudentListener;
mitbk.addActionListener(new AdminBookListener());
JMenuItem mitchpass=new JMenuItem("Change Password");
mitchpass.addActionListener(new AdminChangePasswordListener());
JMenuItem mitlg=new JMenuItem("Logout");
mitlg.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
System.exit(0);
}
});
mbar.add(mnad);
mbar.add(mnact);
mnad.add(mitst);
mnad.add(mitbk);
mnact.add(mitchpass);
mnact.add(mitlg);
return mbar;
}
}
Admin Sortcuts:-
package Layouts;
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import listners.AdminBookListener;
import listners.AdminChangePasswordListener;
import listners.AdminStudentListener;
import listners.Logout;
{
JPanel jp=new JPanel();
jp.setLayout(new GridLayout(4,0));
MyButton jbt=new MyButton("STUDENT");
jbt.setBackground(Color.PINK);
jp.add(jbt);
jbt.addActionListener(new AdminStudentListener());
MyButton jbt1=new MyButton("BOOKS");
jp.add(jbt1);
jbt1.addActionListener(new AdminBookListener());
MyButton jbt2=new MyButton("CHANGE PASSWORD");
jp.add(jbt2);
jbt2.addActionListener(new AdminChangePasswordListener());
MyButton jbt3=new MyButton("Exit");
jbt3.addActionListener(new Logout() );
jp.add(jbt3);
JPanel jp1=new JPanel();
jp1.add(jp);
return jp1;
}
}
Book List:-
package Layouts;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import connectionfile.MyConnection;
jbookbutton.addActionListener(new ActionListener()
@Override
public void actionPerformed(ActionEvent arg0) {
try {
Connection con=MyConnection.getconnection();
Statement st=con.createStatement();
st.executeUpdate("insert into
books(bookname,type,writter,subject)
values('"+bookname+"','"+type+"','"+writter+"','"+sub+"')");
MyPanels.jpcentre.removeAll();
MyPanels.jpcentre.add(new Booklist().bookPanels());
MyPanels.jpcentre.revalidate();
MyPanels.jpcentre.repaint();
}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
});
gconst.gridx=0;
gconst.gridy=0;
gconst.ipadx=20;
gconst.ipady=10;
jbook.add(jlbook,gconst);
gconst.gridx=1;
gconst.gridy=0;
jbook.add(jtbook,gconst);
gconst.gridx=0;
gconst.gridy=1;
jbook.add(jltype,gconst);
gconst.gridx=1;
gconst.gridy=1;
jbook.add(jttype,gconst);
gconst.gridx=0;
gconst.gridy=2;
jbook.add(jlwritter,gconst);
gconst.gridx=1;
gconst.gridy=2;
jbook.add(jtwritter,gconst);
gconst.gridx=0;
gconst.gridy=3;
jbook.add(jlsub,gconst);
gconst.gridx=1;
gconst.gridy=3;
jbook.add(jtsub,gconst);
gconst.gridx=1;
gconst.gridy=4;
jbook.add(jbookbutton,gconst);
jbook.setBackground(Color.GRAY);
return jbook;
}
try{
Connection con=MyConnection.getconnection();
Statement st=con.createStatement();
gconst.gridx=0;
gconst.gridy=0;
jfetch.add(jlbook,gconst);
gconst.gridx=1;
gconst.gridy=0;
jfetch.add(jltype,gconst);
gconst.gridx=2;
gconst.gridy=0;
jfetch.add(jlwritter,gconst);
gconst.gridx=3;
gconst.gridy=0;
jfetch.add(jlsub,gconst);
int j=1;
try {
while(rs.next())
{
gconst.gridx=0;
gconst.gridy=j;
jfetch.add(new
JLabel(rs.getString("bookname")),gconst);
gconst.gridx=1;
gconst.gridy=j;
jfetch.add(new
JLabel(rs.getString("type")),gconst);
gconst.gridx=2;
gconst.gridy=j;
jfetch.add(new
JLabel(rs.getString("writter")),gconst);
gconst.gridx=3;
gconst.gridy=j;
jfetch.add(new
JLabel(rs.getString("subject")),gconst);
Statement
st=con.createStatement();
String
bookname=arg0.getActionCommand();
System.out.println("Delete
from books where id='"+bookname+"'");
st.executeUpdate("Delete from
books where id='"+bookname+"'");
// TODO Auto-generated
method stub
}
catch(Exception e)
{
e.printStackTrace();
}
MyPanels.jpcentre.removeAll();
MyPanels.jpcentre.add(new
Booklist().bookPanels());
MyPanels.jpcentre.revalidate();
MyPanels.jpcentre.repaint();
}
});
gconst.gridx=4;
gconst.gridy=j;
jfetch.add(jdel,gconst);
j=j+1;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
jfetch.setBackground(Color.GRAY);
return jfetch;
}
public JPanel bookPanels()
{
JPanel jp=new JPanel();
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(insertbook());
jp.add(show());
JPanel jpmain=new JPanel();
jpmain.setLayout(new BorderLayout());
jpmain.add(jp);
jpmain.add(new JLabel(" "),BorderLayout.EAST);
jpmain.add(new JLabel(" "),BorderLayout.WEST);
jpmain.add(new JLabel(" "),BorderLayout.SOUTH);
jpmain.add(new JLabel(" "),BorderLayout.NORTH);
jp.setBackground(Color.GRAY);
return jpmain;
}
Books Menu:-
package Layouts;
Librarian:--
package Layouts;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import connectionfile.MyConnection;
}
public librarian(boolean issue)
{
this.issue=issue;
query="select * from books where books.id NOT IN(select book from
issue)";
}
public librarian(String mode)
{
if(mode.equals("available"))
{
query="select * from books where books.id NOT IN(select book from
issue)";
}
else if(mode.equals("due"))
{
query="select * from books where books.id IN(select book from
issue)";
}
else
{
query="select * from books";
}
}
public JPanel show()
try{
Connection con=MyConnection.getconnection();
Statement st=con.createStatement();
rs=st.executeQuery(query );
}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
JLabel jlid=new JLabel("Id");
JLabel jlbook=new JLabel("Bookname");
JLabel jltype=new JLabel("Type");
JLabel jlwritter=new JLabel("Writter");
JLabel jlsub=new JLabel("Subject");
gconst.gridx=0;
gconst.gridy=0;
gconst.ipadx=20;
gconst.ipady=10;
jfetch.add(jlid,gconst);
gconst.gridx=1;
gconst.gridy=0;
jfetch.add(jlbook,gconst);
gconst.gridx=2;
gconst.gridy=0;
jfetch.add(jltype,gconst);
gconst.gridx=3;
gconst.gridy=0;
jfetch.add(jlwritter,gconst);
gconst.gridx=4;
gconst.gridy=0;
jfetch.add(jlsub,gconst);
int j=1;
try {
while(rs.next())
{
gconst.gridx=0;
gconst.gridy=j;
jfetch.add(new JLabel(rs.getString("id")),gconst);
gconst.gridx=1;
gconst.gridy=j;
jfetch.add(new
JLabel(rs.getString("bookname")),gconst);
gconst.gridx=2;
gconst.gridy=j;
jfetch.add(new
JLabel(rs.getString("type")),gconst);
gconst.gridx=3;
gconst.gridy=j;
jfetch.add(new
JLabel(rs.getString("writter")),gconst);
gconst.gridx=4;
gconst.gridy=j;
jfetch.add(new
JLabel(rs.getString("subject")),gconst);
if(issue)
{
gconst.gridx=5;
MyButton jb=new MyButton("Issue Book");
jb.setActionCommand(rs.getString("id"));
jb.addActionListener(new ActionListener() {
@Override
public void
actionPerformed(ActionEvent arg0) {
});
jfetch.add(jb,gconst);
}
j=j+1;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JPanel jpmain=new JPanel();
jpmain.setLayout(new BorderLayout());
jpmain.add(jfetch);
jpmain.add(new JLabel(" "),BorderLayout.EAST);
jpmain.add(new JLabel(" "),BorderLayout.WEST);
jpmain.add(new JLabel(" "),BorderLayout.SOUTH);
jpmain.add(new JLabel(" "),BorderLayout.NORTH);
jfetch.setBackground(Color.GRAY);
return jpmain;
}
public JPanel studentPanels()
{
JPanel jp=new JPanel();
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(show());
jp.add(show());
Librarian Menu:-
package Layouts;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import connectionfile.MyConnection;
import listners.LibAvailListner;
import listners.LibDueBookListner;
import listners.LibIssueBookListner;
rbooks.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try{
String id=JOptionPane.showInputDialog("please enter book
id");
Connection con=MyConnection.getconnection();
Statement st=con.createStatement();
st.executeUpdate("delete from issue where book='"+id+"'");
}
catch(Exception e)
{
e.printStackTrace();
}
}
});
JPanel jp1=new JPanel();
jp.add(abooks);
//jp.add(inbooks);
jp.add(abooks);
jp.add(dbooks);
jp.add(isbooks);
jp.add(rbooks);
jp1.add(jp);
return jp1;
}
My Button:-
package Layouts;
import java.awt.Button;
import java.awt.Color;
import javax.swing.JButton;
My Panels:-
package Layouts;
import java.awt.Button;
import java.awt.Color;
import javax.swing.JButton;
Password:-
package Layouts;
import globals.GlobalVariables;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import connectionfile.MyConnection;
final
jchange.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try{
String prepass=jlpre.getText();
Connection con=MyConnection.getconnection();
Statement st=con.createStatement();
ResultSet rs=null;
try {
rs = st.executeQuery("select password from login
where id='"+GlobalVariables.user+"' ");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(rs.next())
{
try {
if(rs.getString("password").equals(jtpre.getText())&&(jtnew.getText().equals(jltcon.getText(
))))
{
String newp=jtnew.getText();
st.executeUpdate("update login set
password='"+newp+"' where id='"+GlobalVariables.user+"'");
MyPanels.jpcentre.removeAll();
MyPanels.jpcentre.add(new
Password().password1());
MyPanels.jpcentre.revalidate();
MyPanels.jpcentre.repaint();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
{
}
}}}
);
GridBagLayout gd=new GridBagLayout();
GridBagConstraints gc=new GridBagConstraints();
gd.setConstraints(jp,gc);
jp.setLayout(gd);
gc.gridx=0;
gc.gridy=0;
jp.add(jlpre,gc);
gc.gridx=1;
gc.gridy=0;
jp.add(jtpre,gc);
gc.gridx=0;
gc.gridy=1;
jp.add(jlnew,gc);
gc.gridx=1;
gc.gridy=1;
jp.add(jtnew,gc);
gc.gridx=0;
gc.gridy=2;
jp.add(jlcon,gc);
gc.gridx=1;
gc.gridy=2;
jp.add(jltcon,gc);
gc.gridx=1;
gc.gridy=3;
jp.add(jchange,gc);
return jp;
}
public JPanel Passwordpanel()
{
JPanel jp=new JPanel();
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(password1());
jpmain.add(jp);
jpmain.add(new JLabel(" "),BorderLayout.EAST);
jpmain.add(new JLabel(" "),BorderLayout.WEST);
jpmain.add(new JLabel(" "),BorderLayout.SOUTH);
jpmain.add(new JLabel(" "),BorderLayout.NORTH);
jp.setBackground(Color.GRAY);
return jpmain;
}
}
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.border.Border;
import connectionfile.MyConnection;
gconst.gridx=0;
gconst.gridy=0;
gconst.ipadx=10;
gconst.ipady=10;
jp.add(jlname,gconst);
gconst.gridx=1;
gconst.gridy=0;
jp.add(jtname,gconst);
gconst.gridx=0;
gconst.gridy=1;
jp.add(jlemail,gconst);
gconst.gridx=1;
gconst.gridy=1;
jp.add(jtemail,gconst);
gconst.gridx=0;
gconst.gridy=2;
jp.add(jlno,gconst);
gconst.gridx=1;
gconst.gridy=2;
jp.add(jtno,gconst);
gconst.gridx=0;
gconst.gridy=3;
jp.add(jlgender,gconst);
gconst.gridx=1;
gconst.gridy=3;
jp.add(gmf,gconst);
gconst.gridx=0;
gconst.gridy=4;
// jp.add(jlbranch,gconst);
gconst.gridx=1;
gconst.gridy=4;
// jp.add(jtbranch,gconst);
gconst.gridx=1;
gconst.gridy=5;
jp.add(jb,gconst);
gconst.gridx=1;
gconst.gridy=5;
// jp.add(jb1,gconst);
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
String name=jtname.getText();
String email=jtemail.getText();
String gender=null;
String ph=jtno.getText();
if(jr1.isSelected())
{
gender="Male";
}
else if(jr2.isSelected())
{
gender="Female";
}
try
{
Connection
con=MyConnection.getconnection();
Statement st=con.createStatement();
st.executeUpdate("insert into
students(name,contact,gender,branch)
values('"+name+"','"+ph+"','"+gender+"','"+email+"')");
}
catch(Exception e)
{
e.printStackTrace();
}
MyPanels.jpcentre.removeAll();
MyPanels.jpcentre.add(new
Studentlayout().studentPanels());
MyPanels.jpcentre.revalidate();
MyPanels.jpcentre.repaint();
}
});
jp.setBackground(Color.GRAY);
return jp;
}
public JPanel show()
{
Connection conn=connectionfile.MyConnection.getconnection();
ResultSet rs=null;
try {
Statement st=conn.createStatement();
rs=st.executeQuery("select * from students");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JPanel jp=new JPanel();
GridBagLayout gblyt=new GridBagLayout();
GridBagConstraints gbct=new GridBagConstraints();
gblyt.setConstraints(jp, gbct);
jp.setLayout(gblyt);
gbct.gridx=1;
gbct.gridy=0;
jp.add(jlname,gbct);
gbct.gridx=2;
gbct.gridy=0;
jp.add(jlcon,gbct);
gbct.gridx=3;
gbct.gridy=0;
jp.add(jlgen,gbct);
gbct.gridx=4;
gbct.gridy=0;
jp.add(jlbranch,gbct);
int j=1;
try {
while(rs.next())
{
gbct.gridx=0;
gbct.gridy=j;
jp.add(new JLabel(rs.getString("id")),gbct);
gbct.gridx=1;
gbct.gridy=j;
jp.add(new JLabel(rs.getString("name")),gbct);
gbct.gridx=2;
gbct.gridy=j;
jp.add(new JLabel(rs.getString("Contact")),gbct);
gbct.gridx=3;
gbct.gridy=j;
jp.add(new JLabel(rs.getString("Gender")),gbct);
gbct.gridx=4;
gbct.gridy=j;
jp.add(new JLabel(rs.getString("Branch")),gbct);
gbct.gridx=5;
gbct.gridy=j;
MyButton jdel=new MyButton("Delete");
jp.add(jdel,gbct);
jdel.setActionCommand(rs.getString("id"));
jdel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
try
{
Connection
con=MyConnection.getconnection();
Statement st=con.createStatement();
String id=arg0.getActionCommand();
j=j+1;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
jp.setBackground(Color.GRAY);
return jp;
}
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.Statement;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import connectionfile.MyConnection;
import listners.LibAvailListner;
import listners.LibDueBookListner;
import listners.LibIssueBookListner;
rb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try{
String id=JOptionPane.showInputDialog("please enter book
id");
Connection con=MyConnection.getconnection();
Statement st=con.createStatement();
st.executeUpdate("delete from issue where book='"+id+"'");
}
catch(Exception e)
{
e.printStackTrace();
}
}
});
mnad.add(ab);
mnad.add(db);
mnad.add(ib);
mnad.add(rb);
mbar.add(mnad);
return mbar;
}
}
CONCLUSION
This project that I undertook was truly a very rewarding experience for me in
more than one way. It has given a big thrust to my technical knowledge as
prospective Software professional. It has also helped me enhance my skills on the
personal front.
And I feel extremely satisfied by the fact that I have managed to develop
the project of course with equal contribution from my team members. I think I
have exploited the opportunity that came my way to the fullest extent by
increasing my technical know-how and also gaining the valuable work experience
apart from studying the other subjects in our curriculum.
REFRENCES
Java programming
Mastering javascript and Jscript By: James Gasworks Published by: bpb
Web by Design: The Complete Guide By: Molly Holzschlag Published by: bpb