A JavaFX desktop application for managing a music database with full CRUD (Create, Read, Update, Delete) operations, built with Java 21 and MySQL.
- Prerequisites
- Setup
- Database Configuration
- Building the Project
- Running the Application
- Docker Support
- Project Structure
- Features
- Screenshots
- References
- License
- Java 21 installed
- Maven 3.x installed (or use the included Maven Wrapper)
- MySQL 8.x database server running
- JavaFX 21 (automatically managed via Maven dependencies)
Clone this repository and navigate to its root directory:
git clone https://github.com/MeetTak/music_library_fx.git
cd music_library_fx-
Create a MySQL database named
music:CREATE DATABASE music; USE music;
-
Create the
albumstable:CREATE TABLE albums ( artist_id VARCHAR(255), album_id VARCHAR(255), album_name VARCHAR(255) );
-
Update the database credentials in
src/main/java/org/example/db_app/database/DatabaseConnection.java:private static final String URL = "jdbc:mysql://localhost:3306/music"; private static final String USER = "your_username"; private static final String PASSWORD = "your_password";
# On Unix/macOS
./mvnw clean packagemvn clean package# On Unix/macOS
./mvnw javafx:runjava --module-path /path/to/javafx/lib --add-modules javafx.controls,javafx.fxml -jar target/db_app-1.0-SNAPSHOT.jardocker-compose up --builddocker build -t music-library-fx .
docker run music-library-fxNote: Running JavaFX GUI applications in Docker requires X11 forwarding or a virtual display setup.
music_library_fx/
├── src/
│ └── main/
│ ├── java/
│ │ ├── module-info.java
│ │ └── org/example/db_app/
│ │ ├── HelloApplication.java # Main application entry point
│ │ ├── HelloController.java # FXML controller
│ │ ├── database/
│ │ │ └── DatabaseConnection.java # MySQL connection manager
│ │ └── operations/
│ │ ├── DatabaseOperation.java # Operation interface
│ │ ├── insertOperation.java # Insert records
│ │ ├── deleteOperation.java # Delete records
│ │ ├── searchOperation.java # Search/query records
│ │ └── updateOperation.java # Update records
│ └── resources/
│ └── org/example/db_app/
│ └── hello-view.fxml
├── docker-compose.yml
├── Dockerfile
├── pom.xml
├── mvnw / mvnw.cmd
├── LICENSE
└── README.md
| Operation | Description |
|---|---|
| Search | Query albums by album_id, album_name, or artist_id with dynamic table display |
| Insert | Add new album records with artist ID, album ID, and album name |
| Update | Modify existing album names by artist ID and album ID |
| Delete | Remove records by any field (artist ID, album ID, or album name) |
| Dependency | Version | Purpose |
|---|---|---|
| JavaFX Controls | 21 | UI components |
| JavaFX FXML | 21 | FXML support |
| MySQL Connector/J | 8.0.33 | Database connectivity |
| JUnit Jupiter | 5.10.2 | Unit testing (test scope) |