You are on page 1of 92

TRAINING REPORT

ON

Library Management System


SUBMITTED IN PARTIAL FULFILLMENT OF AWARD OF DEGREE
BACHELOR OF TECHNOLOGY
in
Computer Science & Engineering
Submitted By:
BALJEET SAINI(1712215)

Submitted To:

DEPARTMENT OF COMPUTER SCIENCE &


ENGINEERING

HCTM Technical Campus, Kaithal - 136027


(Affiliated to Kurukshetra University, Kurukshetra)

TABLE OF CONTENTS

S. No.

SECTION NAME

1.

Acknowledgement

2.

Training Certificate

3.

Candidate Declaration

4.

Abstract

5.

Introduction to Project

6.

Hardware and Software Requirements

7.

Introduction to Java Enterprise Edition

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.

Signature of the Student


Baljeet Saini (1712215)

CANDIDATE DECLARATION
I hereby certify that the present training report being submitted by me entitled LIBRARY

MANAGEMENT SYSTEM partially fulfillment for B.TECH in CSE to HCTM


Kaithal

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.

INTRODUCTION ABOUT THE PROJECT


Introduction:
Module wise Description
Three main modules
1. Administrator module.
2. Student module.
These two modules are further subdivided in sub modules according to there role in the
institution.

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

of all the registered users.

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.

HARDWARE AND SOFTWARE REQUIREMENTS

SOFTWARE REQUIREMENT

Front end:- Notepad or Netbeans

Backend:- Ms Access

jdk 1.6

Compiler used:- javac

Interpreter:- JVM

Browser:- appletviewer or any browser

Operating System:- Window XP or Window7

HARDWARE REQUIREMENT

Primary Memory: 256 mb RAM or higher

Secondary Memory: Minimum 10 GB Hard Disk

Processor: Intel P4,Core 2 Duo,i3,i5

Color Monitor

Keyboard

Mouse

7..256 mb RAM

INTRODUCTION TO JAVA ENTERPRISE EDITION

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.

Technique used: Java JDK 1.6


Java jdk 1.6 is a programming language used for developing various types of projects.
Java can be used to develop database handling projects, e-line projects with the help
using any compatible database engine like MS-SQL, ORACLE 8, and MS-Access etc.

The Java Architecture :


Javas strength comes from its unique architecture. The Java needed a language that was
above all, simple for the programmer to use. Yet in order to create reliable network
applications, Java needed to be able to run securely over a network and at the same time,
work on a wide range of platforms. Java fulfills all of these goals and more.

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.

4.Open Standards/Platforms Independence


Today, java VMs are available for more than a dozen diff. Hardware and Operating
system combination. The exciting aspect of javas cross-platform capability is that java
class files do not need to be compiled for each platform in advance. The same compiled
java program will work on the PC, Macintosh & every other platform that runs a java
VM. A java application we write on our
system today should run on every supported platform, even those do not exist yet. This
reduces the development time by a very big factor.

5. Distributed and Dynamic


In the windows operating systems, parts of programs can be placed into Dynamic link
libraries so that they can be shared and loaded dynamically; i.e. when the program is
running. The operating system does the final stage of linking at execution time. Using
shared DLL (Dynamic Link Library) saves memory and improves the modality of the
software.
Java takes Dynamic Libraries a step further. The VM class loader fetches class files from
the network, as well from the disk, providing location transparency, making java
applications distributed as well as Dynamic.

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.

Front End: Notepad


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.

Back End: Ms Access


This end deals with the database handling of the project according the user requirement,
this end is not visible to the application user.

Operating System: WINDOWS


As Windows XP is a better platform for both JDK 1.6,Ms Access thus we are using
Windows- Professional operating system. The features of Windows XP are:
Windows XP can support 256RAS (Remote Access Service) connections at a time.
High level of security is ensured through the Windows Directory Service (NTDS) that
has full control over the user accounts, their access privileges and rights over resources.
It supports RAID (Redundant Array of Inexpensive Disks) technology for providing fault
tolerance.
It supports import and export of files through its directory replication services.
Using per-seat licensing with Widows Server, Client licenses can be purchased once and
used with as many servers as required.

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

company's first all-new design since the introduction of the P6 microarchitecture of


the Pentium Pro CPUs in 1995. NetBurst differed from P6 (Pentium III, II, etc.) by
featuring a very deep instruction pipeline to achieve very high clock speeds. Intel claimed
that NetBurst would allow clock speeds of up to 10 GHz, however, severe problems with
heat dissipation (especially with the Prescott Pentium 4) limited CPU clock speeds to a
much lower 3.8 GHz. [3]
In 2004, the initial 32-bit x86 instruction set of the Pentium 4 microprocessors was
extended by the 64-bit x86-64 set.

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

the SSE2 and,

in

the

Prescott-based

Pentium

4s, SSE3 instruction sets to accelerate calculations, transactions, media processing, 3D


graphics, and games. Later versions featured Hyper-Threading Technology (HTT), a
feature to make one physical CPU work as two logical CPUs. Intel also marketed a
version of their low-end Celeron processors based on the NetBurst microarchitecture
(often referred to as Celeron 4), and a high-end derivative, Xeon, intended
for multiprocessor servers and workstations. In 2005, the Pentium 4 was complemented
by the Pentium D and Pentium Extreme Edition dual-core CPU.

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

Java bytecodes the platform-

independent codes interpreted by the interpreter on the Java platform.

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.

The Java Platform


A platform is the hardware or software environment in which a program runs. We've
already mentioned some of the most popular platforms like Windows 2000, Linux,
Solaris, and MacOS. Most platforms can be described as a combination of the operating
system and hardware. The Java platform differs from most other platforms in that it's a
software-only platform that runs on top of other hardware-based platforms.
The Java platform has two components:

The Java Virtual Machine (Java VM)

The Java Application Programming Interface (Java API)

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.

What Can Java Technology Do?


The most common types of programs written in the Java programming language are
applets and applications. If you've surfed the Web, you're probably already familiar with
applets. An applet is a program that adheres to certain conventions that allow it to run
within a Java-enabled browser.

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.

Applets: The set of conventions used by applets.

Networking: URLs, TCP (Transmission Control Protocol), UDP (User


Datagram Protocol) sockets, and IP (Internet Protocol) addresses.

Internationalization: Help for writing programs that can be localized for


users worldwide. Programs can automatically adapt to specific locales and
be displayed in the appropriate language.

Security: Both low level and high level, including electronic signatures,
public and private key management, access control, and certificates.

Software components: Known as JavaBeansTM, can plug into existing


component architectures.

Object serialization: Allows lightweight persistence and communication


via Remote Method Invocation (RMI).

Java Database Connectivity (JDBCTM): Provides uniform access to a


wide range of relational databases.

Features of JAVA Technology

Get started quickly: Although the Java programming language is a


powerful object-oriented language, it's easy to learn, especially for
programmers already familiar with C or C++.

Write less code: Comparisons of program metrics (class counts, method


counts, and so on) suggest that a program written in the Java programming
language can be four times smaller than the same program in C++.

Write better code: The Java programming language encourages good


coding practices, and its garbage collection helps you avoid memory leaks.
Its object orientation, its JavaBeans component architecture, and its wideranging, easily extendible API let you reuse other people's tested code and
introduce fewer bugs.

Develop programs more quickly: Your development time may be as


much as twice as fast versus writing the same program in C++. Why? You
write fewer lines of code and it is a simpler programming language than
C++.

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.

Making the Connection


The second step in establishing a connection is to have the appropriate driver
connect to the DBMS. The following line of code illustrates the general idea:
Connection con = DriverManager.getConnection (url,
"MyLogin", "myPassword");

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

Creating JDBC Statements


A Statement object is what sends your SQL statement to the DBMS. You simply
create a Statement object and then execute it, supplying the appropriate execute
method with the SQL statement you want to send. For a SELECT statement, the
method to use is executing Query. For statements that create or modify tables, the
method to use is executing Update.
It takes an instance of an active connection to create a Statement object.

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.

Retrieving Values from Result Sets


We now show how you send the above SELECT statements from a program
written in the Java programming language and how you get the results we
showed.

JDBC returns results in a ResultSet object, so we need to declare an instance of


the class Result Set to hold our results.

Using the Method next


In order to access the names and prices, we will go to each row and retrieve the
values according to their types. The method next moves what is called a cursor to
the next row and makes that row (called the current row) the one upon which we
can operate. Since the cursor is initially positioned just above the first row of a
ResultSet object, the first call to the method next moves the cursor to the first row
and makes it the current row. Successive invocations of the method next move the
cursor down one row at a time from top to bottom. Note that with the JDBC 2.0
API, covered in the next section, you can move the cursor backwards, to specific
positions, and to positions relative to the current row in addition to moving the
curs or forward.

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.

INTERFACES USED IN THE PROJECT

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

Built-in Classes Used:


JMenuBar
JMenuItem
Frame
Choice
Button
JTextArea
String
Connection
ResultSet
Statement
JPasswordField
JTextField
Label

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.

This is the home for administrator. It contain Eight Buttons.

Admin will register the new user by this frame.

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 Admin will send the public message to users .

By this Frame Registered User can login to User home by entering the Username and
Password.

This is the home for User .It contain three Buttons.

By this Frame User can view personnel information by Rollno.

By this Frame User can enter the academic record .

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.

NewUserRegistration: This table contains three field name NewUserName,Password


and ConfirmPassword.

Add New User: This table contains nine fields Name,Rollno,Branch,Sem,Uid,Address,

City,State,Mob no.

Send Msg: This table contains one field name sendpublicmsg.

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;

public class AdminMenu {

public JMenuBar Insert()


{
JMenuBar mbar=new JMenuBar();
JMenu mnad=new JMenu("Admin");
JMenu mnact=new JMenu("Account");

JMenuItem mitst=new JMenuItem("Student");


mitst.addActionListener(new AdminStudentListener());
JMenuItem mitbk=new JMenuItem("Books");

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;

public class AdminShortCuts {


public JPanel menu()

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

public class Booklist {

public JPanel insertbook()


{

JPanel jbook=new JPanel();

JLabel jlbook=new JLabel("Bookname");


final JTextField jtbook=new JTextField(20);

JLabel jltype=new JLabel("Type");


final JTextField jttype=new JTextField(20);

JLabel jlwritter=new JLabel("Writter");


final JTextField jtwritter=new JTextField(20);

JLabel jlsub=new JLabel("Subject");


final JTextField jtsub=new JTextField(20);

MyButton jbookbutton=new MyButton("Addbook");

jbookbutton.addActionListener(new ActionListener()

@Override
public void actionPerformed(ActionEvent arg0) {

// TODO Auto-generated method stub


String bookname=jtbook.getText();
String type=jttype.getText();
String writter=jtwritter.getText();
String sub=jtsub.getText();

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

}
});

GridBagLayout gblayout=new GridBagLayout();

GridBagConstraints gconst=new GridBagConstraints();


gblayout.setConstraints(jbook,gconst);
jbook.setLayout(gblayout);

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

public JPanel show()

JPanel jfetch=new JPanel();

GridBagLayout gblayout=new GridBagLayout();


GridBagConstraints gconst=new GridBagConstraints();
gblayout.setConstraints(jfetch,gconst);
jfetch.setLayout(gblayout);
ResultSet rs=null;

try{
Connection con=MyConnection.getconnection();
Statement st=con.createStatement();

rs=st.executeQuery("select * from books" );


}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}

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

MyButton jdel=new MyButton("Delete");


jfetch.add(jdel,gconst);
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
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;

public class BooksMenu {

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 class librarian {


boolean issue=false;
String query=null;
public librarian()
{

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

JPanel jfetch=new JPanel();

GridBagLayout gblayout=new GridBagLayout();


GridBagConstraints gconst=new GridBagConstraints();
gblayout.setConstraints(jfetch,gconst);
jfetch.setLayout(gblayout);
ResultSet rs=null;

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

// TODO Autogenerated method stub


String
bid=arg0.getActionCommand();
String
sid=JOptionPane.showInputDialog("Enter Student ID");
Connection con=MyConnection.getconnection();
Statement st=null;
try {
st = con.createStatement();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
st.executeUpdate("insert into issue(student,
book,date)values('"+sid+"', '"+bid+"', curdate())");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MyPanels.jpcentre.removeAll();
MyPanels.jpcentre.add(new librarian(true).show());
MyPanels.jpcentre.revalidate();
MyPanels.jpcentre.repaint();
}

});

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

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

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;

public class LibrarianMenu {


public JPanel menu()
{
JPanel jp=new JPanel();
jp.setLayout(new GridLayout(5,0));
MyButton abooks=new MyButton("AVAILABLE BOOKS");
//MyButton inbooks=new MyButton("INNER BOOKS");
abooks.addActionListener(new LibAvailListner());
MyButton dbooks=new MyButton("DUE BOOKS");
dbooks.addActionListener(new LibDueBookListner());
MyButton isbooks=new MyButton("ISSUE BOOK");
isbooks.addActionListener(new LibIssueBookListner());
MyButton rbooks=new MyButton("RETURN BOOKS");

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;

public class MyButton extends JButton {


public MyButton(String text)
{
setBackground(Color.PINK);
setText(text);
setForeground(Color.BLUE);
}
public MyButton()
{
setBackground(Color.PINK);
}
}

My Panels:-

package Layouts;

import java.awt.Button;
import java.awt.Color;

import javax.swing.JButton;

public class MyButton extends JButton {


public MyButton(String text)
{
setBackground(Color.PINK);
setText(text);
setForeground(Color.BLUE);
}
public MyButton()
{
setBackground(Color.PINK);
}
}

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;

public class Password {


public JPanel password1()
{
JPanel jp=new JPanel();
final JLabel jlpre=new JLabel("Previous Pssword");
final JPasswordField jtpre=new JPasswordField(20);

JLabel jlnew= new JLabel("New Password");

final

JPasswordField jtnew=new JPasswordField(20);

JLabel jlcon=new JLabel("Confirm Password");


final JPasswordField jltcon=new JPasswordField(20);
MyButton jchange=new MyButton("Change Password");

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

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

Student Layout:package Layouts;


import globals.GlobalVariables;

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;

public class Studentlayout {

public JPanel insert()


{
JPanel jp=new JPanel();

JLabel jlname=new JLabel("Name");


final JTextField jtname=new JTextField(20);
JLabel jlemail=new JLabel("Branch");
final JTextField jtemail=new JTextField(20);

JLabel jlno=new JLabel("ph no.");


final JTextField jtno=new JTextField(20);

JLabel jlbranch=new JLabel("Branch");


JTextField jtbranch=new JTextField(20);

JLabel jlgender=new JLabel("Gender");


JPanel gmf=new JPanel();
ButtonGroup b=new ButtonGroup();
final JRadioButton jr1=new JRadioButton("male");
final JRadioButton jr2=new JRadioButton("female");
b.add(jr1);
b.add(jr2);
gmf.add(jr1);
gmf.add(jr2);
gmf.setBackground(Color.GRAY);
jr1.setBackground(Color.GRAY);
jr2.setBackground(Color.GRAY);
MyButton jb=new MyButton("insert");

GridBagLayout gblayout=new GridBagLayout();


GridBagConstraints gconst=new GridBagConstraints();
gblayout.setConstraints(jp,gconst);
jp.setLayout(gblayout);

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

jb.addActionListener(new ActionListener()//Caling cls to connect sinup


button
{

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

JLabel jlid=new JLabel("Id");


JLabel jlname=new JLabel("Name");
JLabel jlcon=new JLabel("Contact");
JLabel jlgen=new JLabel("Gender");
JLabel jlbranch=new JLabel("Branch");
gbct.gridx=0;
gbct.gridy=0;
gbct.ipadx=20;
gbct.ipady=10;
jp.add(jlid,gbct);

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

st.executeUpdate("Delete from students where


id='"+id+"'");
// TODO Auto-generated method stub
}
catch(Exception e)
{
e.printStackTrace();
}
MyPanels.jpcentre.removeAll();
MyPanels.jpcentre.add(new
Studentlayout().studentPanels());
MyPanels.jpcentre.revalidate();
MyPanels.jpcentre.repaint();
}
});

j=j+1;

}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

jp.setBackground(Color.GRAY);
return jp;
}

public JPanel studentPanels()


{
JPanel jp=new JPanel();
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(insert());
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;
}

Student menu:- package Layouts;

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;

public class StudentMenu {

public JMenuBar Insert()


{
JMenuBar mbar=new JMenuBar();
JMenu mnad=new JMenu("Book");

JMenuItem ab=new JMenuItem("Available books");


ab.addActionListener(new LibAvailListner());
JMenuItem db=new JMenuItem("Due books");
db.addActionListener(new LibDueBookListner());

JMenuItem ib=new JMenuItem("Issue Books");


ib.addActionListener(new LibIssueBookListner());
JMenuItem rb=new JMenuItem("Return Books");

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

By: E Balaguruswamy Published by: McGraw hill

Complete references By: Herbert Schleded Published by: mcgraw hill

Mastering javascript and Jscript By: James Gasworks Published by: bpb

Web by Design: The Complete Guide By: Molly Holzschlag Published by: bpb

Sun Microsystems online java code help?

http://www.w3school.com/ (complete java tutorial)

http://www.roseindia.net/ (complete jsp tutorial)

You might also like