OOPS PBL
OOPS PBL
BACHELOR OF TECHNOLOGY
IN
By
S.Sai kishore – 22R11A0587
S.Moulali – 22R11A0585
V.Sai Anirudh– 22R11A0592
December -2023
TABLE OF CONTENTS
1 Abstract 1
2 Introduction 2
3 System Design 3
7 Implementation 8 - 12
8 Conclusion 13
9 References 14
ABSTRACT
The provided Java project, named FacultyBookManager, is a Swing-based graphical user interface (GUI)
application designed for managing the issuance of books to faculty members. The application interacts with
a MySQL database to store and retrieve information about issued books. The abstract of the project
encompasses the following aspects:
Objective: The primary goal of the FacultyBookManager project is to provide a user-friendly interface for
faculty members to issue books and view information related to issue books. The application facilitates
interaction with a backend MySQL database to store and retrieve data regarding book issuances.
Key Components:
1
INTRODUCTION
The Faculty Book Manager, an innovative Java-based application designed to enhance the efficiency and
organization of book issuance for faculty members in educational institutions. This project combines a user-
friendly graphical interface with seamless MySQL database integration, offering a comprehensive solution
for managing and tracking the issuance of books.
1. Intuitive User Interface: The application features an intuitive and visually appealing GUI created with Java
Swing. Users, including faculty members and administrators, can easily navigate through the interface,
making the book issuance and viewing processes straightforward and accessible.
2. Database Integration: Leveraging JDBC, the Faculty Book Manager seamlessly connects to a MySQL
database. This integration ensures the secure storage of book issuance data, providing a reliable and scalable
solution for educational institutions of varying sizes.
3. Efficient Book Issuance: Faculty members can issue books by providing essential details such as Book ID,
Faculty ID, Issue Date, Department Name, Book Name, and Faculty Name. The application guides users
through the issuance process and provides instant feedback on the success or failure of the transaction.
4. Comprehensive Book Viewing: The application offers a dedicated feature for administrators to view all
issued books. This comprehensive list includes Book ID, Faculty ID, Issue Date, Department Name, Book
Name, and Faculty Name, promoting transparency and accountability in book management.
5. Error Handling and User Feedback: Robust error-handling mechanisms are implemented to ensure a smooth
user experience. Users receive informative messages through JOptionPane dialogs in the event of issues or
successful operations, facilitating effective communication between the application and its users.
For optimal use of the Faculty Book Manager, users are advised to replace the placeholder database
connection details in the code with their actual MySQL database credentials. This customization ensures a
secure and personalized interaction with the database, aligning the application with the specific requirements
of each educational institution.
Whether you are a faculty member seeking to issue books or an administrator overseeing the book
management process, the Faculty Book Manager is designed to simplify workflows, enhance efficiency, and
contribute to the overall organization of educational resources.
2
Software Management
S. No. Description
1. Eclipse/VS Code/Any java Compiler
Hardware Management
S. No. Description
1. Windows 7/8/10/11
Existing System
The existing book issuance system relies on manual, paper-based processes within the educational
institution. Faculty members submit requests using physical forms, and administrators manage records
through traditional filing systems or spreadsheets. This manual approach introduces the risk of errors, limits
accessibility, and may result in inefficient tracking and a lack of transparency in monitoring educational
resource usage.
Proposed System
The proposed Faculty Book Manager offers a digital solution to overcome the limitations of the existing
manual system. With an intuitive GUI and MySQL database integration, faculty members can digitally
submit detailed book issuance requests. The system enables efficient tracking, centralized record-keeping,
and real-time updates on book issuances. Its user-friendly interface, error-handling mechanisms, and
accessibility enhancements aim to streamline the overall management of book issuances, addressing the
challenges of the existing manual system.
3
Java GUI
Java GUI (Graphical User Interface) refers to the graphical elements that allow users to interact with Java
applications. It enables the creation of visual components like windows, buttons, text fields, and more,
making the user experience more interactive and visually appealing.
Java Swing and AWT (Abstract Window Toolkit) are two libraries in Java used for building graphical user
interfaces (GUIs). Both of them provide classes and components to create windows, buttons, text fields, and
other GUI elements.
4
To use AWT we use java.awt package.
To use swing we use javax.swing package.
Component: (java.awt)
Component is an abstract class that encapsulates all of the attributes of a visual component.
A component is something that can be displayed on a two-dimensional screen and with which the user can
interact.
Attributes of a component include a size, a location, foreground and background colors, whether or not
visible etc.,
setLocation(int, int),
getLocation() ---To set and get component location
setSize(int, int) ---To set component size
setVisible() ---To show or hide the component
setForeground(Color), getForeground() ---To set and get foreground colors
setBackground(Color), getBackground() ---To set and get background colors
Container: (java.awt)
This is a type of component that can nest other components within it.
A Container is responsible for laying out (that is, positioning) any components that it contains.
JFrame
JFrame is a window that is not contained inside another window- a Top level container.
JFrame is the basis to contain other user interface components in Java graphical applications.
5
JFrame’s constructors:
JFrame( )
JFrame(String title)
After a Jframe window has been created, it will not be visible until you call setVisible( true).
Ex:
Layout Managers
JPanel FlowLayout
JFrame BorderLayout
JWindow BorderLayout
6
Steps in Java GUI Programming
In Java, interacting with a MySQL database is accomplished using the JDBC (Java Database Connectivity)
API. To begin, you must download and include the MySQL Connector/J driver in your project's class path.
This driver facilitates the connection between Java applications and MySQL databases. Once the driver is set
up, establishing a connection to the database is a crucial step. This is achieved by specifying the database
URL, username, and password within the DriverManager.getConnection() method. A utility class, like the
DatabaseConnection example provided, can be used to handle this connection.
In the provided Java code snippets, placeholders like "your database", "your username", "your
password", "your table", and "column name" should be replaced with the actual details of your MySQL
database, username, password, table name, and column names, respectively. It is essential to handle
exceptions appropriately, particularly in a production environment, to ensure robust error management and
improve the overall reliability of the application.
7
IMPLEMENTATION
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
public FacultyBookManager() {
super("Faculty Book Manager");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(7, 2));
add(new JLabel("Book ID:"));
bookIdField = new JTextField();
add(bookIdField);
pack();
setLocationRelativeTo(null);
}
try {
// Replace these details with your own database connection details
String url = "jdbc:mysql://localhost:3306/library";
String user = "root";
String password = "password";
9
int rowsAffected = preparedStatement.executeUpdate();
if (rowsAffected > 0) {
JOptionPane.showMessageDialog(this, "Book issued successfully!");
} else {
JOptionPane.showMessageDialog(this, "Failed to issue book.");
}
}
} catch (SQLException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(this, "Error: " + ex.getMessage());
}
}
while (resultSet.next()) {
String bookId = resultSet.getString("book_id");
String facultyId = resultSet.getString("faculty_id");
String issueDate = resultSet.getString("issue_date");
String departmentName = resultSet.getString("department_name");
String bookName = resultSet.getString("book_name");
String facultyName = resultSet.getString("faculty_name");
10
if (result.length() == 14) { // Length of "Issued Books:\n\n"
result.append("No books issued yet.");
}
JOptionPane.showMessageDialog(this, result.toString());
}
} catch (SQLException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(this, "Error: " + ex.getMessage());
}
}
11
OUTPUT
12
CONCLUSION
In conclusion, the Faculty Book Manager project offers a robust and efficient solution for streamlining the
book issuance process within educational institutions. The transition from a manual, paper-based system to a
digital platform introduces several benefits, significantly improving the overall management of educational
resources.
By leveraging Java's JDBC API and integrating seamlessly with a MySQL database, the Faculty Book
Manager enhances data accuracy and accessibility. The user-friendly graphical interface simplifies the book
issuance process for faculty members and administrators alike, promoting ease of use and reducing the
likelihood of errors associated with manual data entry.
The centralized record-keeping system ensures that all information related to book issuances is securely
stored and easily retrievable. Real-time updates on book issuances, coupled with efficient tracking and
monitoring features, provide administrators with valuable insights into the utilization of educational
resources.
The project's focus on error handling mechanisms enhances the reliability of the system, ensuring that users
receive informative feedback in case of issues during the book issuance process. This not only contributes to
a smooth user experience but also aids in maintaining the integrity of the database.
In summary, the Faculty Book Manager project represents a significant advancement in the management of
book issuances within educational institutions. Its digital approach not only modernizes existing processes
but also introduces efficiencies that contribute to a more transparent, accessible, and well-organized
educational resource management system. The successful integration of Java and MySQL technologies
demonstrates the project's commitment to providing a scalable and adaptable solution for diverse academic
environments.
13
REFERENCES
1. www.geeksforgeeks.org
2. www.w3schools.com
3. wikipedia.com
4. github.com
14