Advanced Java Programming Capstone
(FSC-CSC-311-Capstone)
Demo.mp4
This project was the fourth and final assignment for my Advanced Programming class in Java.
The goal was to take concepts learned from previous assignments and put them together for an original final project.
The concepts and required features are: a GUI with ListView and animations, SQL Database with JDBC, JSON, Threads, Lambdas and Streams, and a Collection class.
To fulfill these requirements, I wrote a music player.
This project was made using Java in Apache Netbeans.
This program is a music player that has been modeled on the Spotify user experience.
- Browse the song library:
- Create a playlist:
- Browse playlists:
- Select a playlist:
- Play a song:
- Delete a playlist:
This Java code satifies the professor requirements thorugh the following:
- GUI: The project uses JavaFX for its GUI and has a Home.fxml and CreatePlaylist.fxml file for creating the interface. It has multiple controls such as ListView, TableView, and various buttons for managing songs and playlists. The application fetches data from the AccessDatabase.accdb file using JDBC and displays it in the GUI. It fills the controls with data from the Library and Playlists tables in the database. The applcation also utilizes fade animations to transition between song changes when presenting album art.
- SQL Database: The project uses a Microsoft Access database file (AccessDatabase.accdb) containing two tables: Library and Playlists. It uses JDBC to interact with the database (DatabaseConnection.java).
- JSON: The application can import and export playlist data as JSON (Playlist.java). The SongsJSON field in the Playlists table stores the list of songs as a JSON string.
- Threads: The project does not currently utilize threads.
- Lambdas and Streams: The project uses lambdas in the event handlers for various controls (HomeController.java). The project does not currently utilize streams.
- Collection Class: The application uses the ObservableList class for maintaining song lists and playlist data.
The HomeController class fetches song data from the Library table in the AccessDatabase.accdb file using the DatabaseConnection class.
The song data is then displayed in the TableView in the main interface, where users can see the song title, artist, and release year.
Click the "Create Playlist" button in the main interface to open the CreatePlaylist.fxml file.
The CreatePlaylist.fxml file defines the interface for creating a new playlist, including a TextField for the playlist name and a TableView for selecting songs.
In the CreatePlaylistController class, the song data from the Library table is fetched and displayed in the TableView.
Users can select songs by clicking on them in the TableView.
After selecting the desired songs, users can enter a name for the playlist in the TextField and click the "Create Playlist" button.
The CreatePlaylistController class will then create a Playlist object containing the selected songs and save it to the Playlists table in the AccessDatabase.accdb file as a JSON string.
The HomeController class fetches playlist data from the Playlists table in the AccessDatabase.accdb file.
The playlist data is then displayed in the ListView in the main interface, where users can see the playlist names.
Users can select a playlist by clicking on it in the ListView.
The HomeController class will fetch the songs in the selected playlist and display them in the TableView.
Users can play a song by selecting it in the TableView and clicking the "Play" button in the main interface.
Currently, the play functionality is not implemented in the provided code. You may consider using a JavaFX MediaPlayer for playing the selected song's audio file.
Users can delete a playlist by selecting it in the ListView and clicking the "Delete Playlist" button in the main interface.
The HomeController class will then remove the selected playlist from the Playlists table in the AccessDatabase.accdb file.