Skip to content

MeetTak/musicLibraryFX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music Library FX

A JavaFX desktop application for managing a music database with full CRUD (Create, Read, Update, Delete) operations, built with Java 21 and MySQL.


Table of Contents


Prerequisites

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

Setup

Clone this repository and navigate to its root directory:

git clone https://github.com/MeetTak/music_library_fx.git
cd music_library_fx

Database Configuration

  1. Create a MySQL database named music:

    CREATE DATABASE music;
    USE music;
  2. Create the albums table:

    CREATE TABLE albums (
        artist_id VARCHAR(255),
        album_id VARCHAR(255),
        album_name VARCHAR(255)
    );
  3. 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";

Building the Project

Using Maven Wrapper (Recommended)

# On Unix/macOS
./mvnw clean package

Using System Maven

mvn clean package

Running the Application

Using Maven

# On Unix/macOS
./mvnw javafx:run

Using JAR (Note: JavaFX modules required)

java --module-path /path/to/javafx/lib --add-modules javafx.controls,javafx.fxml -jar target/db_app-1.0-SNAPSHOT.jar

Docker Support

Using Docker Compose

docker-compose up --build

Using Docker Directly

docker build -t music-library-fx .
docker run music-library-fx

Note: Running JavaFX GUI applications in Docker requires X11 forwarding or a virtual display setup.


Project Structure

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

Features

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)

Dependencies

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)

References

About

Creating an application using javafx that can interact with the database

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors