Homework 7 - Music Player

Introduction

In this assignment you will practice

Problem Description

In this assignment, you will be creating a GUI to let you read and play mp3 music files.

Solution Description

Write a GUI program named MusicPlayer.java that reads all of the mp3 files in a folder, lists them, let’s you play the files, and allows you to filter them.

Your program should display the mp3 files in the same directory as MusicPlayer.java as Media objects in a TableView. The table should display a column called File Name and a column called Attributes. Under Attributes, the program should display the Artist, Title, and Album associated with the mp3 file.

Under the TableView, there should be four buttons:

Sample display of these mp3 files:

window

The user should not be able to both click “Play” and “Pause”, only one should be clickable at a time. The same goes for “Search Songs” and “Show all Songs”. There should never be more than one song playing. Name your window, “Music Player”.

Unlike previous assignments, you are allowed to import almost any class in the Java Standard Library to help you do this assignment. All classes that come from packages that start with java or javafx are fine, just don’t use anything that is in the javax package.

Grading

Submit code that compiles!!!

Non-compiling code will receive a 0. For this homework, you need to earn at least 50 points in order to get any points at all on your course grade from this assignment.

Tips and Considerations

Be sure to look in the JavaFX API for a solution to your problem, before asking on Piazza.

Prioritize your work to get as many points as you can. Even if you cannot display the attributes and cannot implement a search function, there would still be 80 potential points you could get.

MediaPlayer is a very handy class for this assignment.

Checkstyle

For each of your homework assignments we will run checkstyle and deduct one point for every checkstyle error.

For this homework the checkstyle cap is 100, meaning you can lose up to 100 points on this assignment due to style errors.

Collaboration

When completing homeworks for CS 1331 you may talk with other students about:

Examples of approved/disapproved collaboration:

OKAY: “Hey, I’m really confused on how we are supposed to implement this part of the homework. What strategies/resources did you use to solve it?”

BY NO MEANS OKAY: “Hey… the homework is due in like 20 minutes… Can I see your code? I promise won’t copy it directly!”

In addition to the above rules, note that it is not allowed to upload your code to any sort of public repository. This could be considered an Honor Code violation, even if it is after the homework is due.

Submission

Submit only MusicPlayer.java and no other attatchments such as mp3 files. When you’re ready, double-check that you have submitted and not just saved a draft. Download the file and compile it to assure that nothing went wrong with the submission process.

File needed:

Verify the Success of Your Submission to Canvas

Practice safe submission! Verify that your HW file was truly submitted correctly, the upload was successful, and that your program runs with no syntax or runtime errors. It is solely your responsibility to turn in your homework and practice this safe submission safeguard.