A desktop application built with JavaFX, FXML, MySQL, and Maven, designed for managing a collection of books.
- π Search books by title
- β Insert new books into the database
- βοΈ Update selected book details
- β Delete selected books
- π Refresh the book list
π °οΈ Sort books alphabetically by title- π FXML-based UI switching (Primary β Secondary views)
librarysystem/
βββ pom.xml
βββ src/
βββ main/
βββ java/
β βββ module-info.java
β βββ com/
β βββ mylibrary/
β βββ Book.java
β βββ LibraryUI.java
βββ resources/
βββ com/
βββ mylibrary/
βββ primary.fxml
βββ secondary.fxml
- Java 22 (configured for Java 11 compatibility via
pom.xml) - JavaFX 22.0.2 (Controls & FXML)
- MySQL + JDBC
- Maven
- FXML for UI layout
Run the following SQL script in MySQL to set up the required table:
CREATE DATABASE IF NOT EXISTS LibraryDB;
USE LibraryDB;
CREATE TABLE IF NOT EXISTS Books (
book_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
author VARCHAR(255) NOT NULL,
available BOOLEAN NOT NULL
);Edit your database credentials in LibraryUI.java:
private Connection connect() throws SQLException {
String url = "jdbc:mysql://localhost:3306/LibraryDB";
String user = "root"; // β change if needed
String password = "password"; // β change if needed
return DriverManager.getConnection(url, user, password);
}-
Install Java 11+ and MySQL.
-
Set up the database (see above).
-
Clone this repository:
git clone https://github.com/UmarlyPoeta/LibrarySystem.git cd LibrarySystem -
Run the application with Maven:
mvn clean javafx:run
π‘ Ensure your IDE supports JavaFX and FXML (like IntelliJ IDEA with JavaFX plugin).
The pom.xml includes:
- JavaFX dependencies (
javafx-controls,javafx-fxml) - MySQL Connector/J
- JavaFX Maven Plugin for simplified running
primary.fxmlandsecondary.fxmlexist for future expansion using FXML-based scene switching.- Controllers (
PrimaryController,SecondaryController) are referenced but not implemented yet in the provided code.
- β Hook up FXML views to actual logic
- π Add user authentication
- π¦ Export book data (CSV/JSON)
- π Add filter by availability
- π§ͺ Add JUnit tests
This project is open source and available for educational use and contributions.