Complete assignment #1
@@ -1,72 +1,123 @@
|
||||
# Seventh Assignment — JavaFX Music Player Project
|
||||
# 🎵 Music Player
|
||||
|
||||
This is a starter JavaFX application for a simple Music Player interface. Your goal is to design the UI and connect it to the provided controller logic to create basic music player interactions.
|
||||
A minimal JavaFX music player with playlist support and dark mode.
|
||||
|
||||
## 📋 Assignment Objectives
|
||||
---
|
||||
|
||||
### Complete the following features:
|
||||
## Features
|
||||
|
||||
**1. Design the Music Player UI**
|
||||
- Play, pause, skip, and seek through songs
|
||||
- Shuffle and repeat modes
|
||||
- Volume control
|
||||
- Album art display (loaded from file metadata)
|
||||
- Library tab — manage all your songs
|
||||
- Playlists tab — create custom playlists and add songs to them
|
||||
- Dark mode toggle
|
||||
- Right-click on any song to add it to a playlist
|
||||
|
||||
Create a layout for a simple music player interface. Your UI should display at least **three songs**, each containing:
|
||||
---
|
||||
|
||||
- Song title
|
||||
- Artist name
|
||||
- Duration
|
||||
- A **Play** button
|
||||
- An **Add to Playlist** button
|
||||
## Project Structure
|
||||
|
||||
**2. Connect UI Components to the Controller**
|
||||
```
|
||||
MusicPlayer/
|
||||
├── src/
|
||||
│ └── main/
|
||||
│ ├── java/sbu/javafx/
|
||||
│ │ ├── MainApp.java
|
||||
│ │ ├── MusicController.java
|
||||
│ │ ├── Song.java
|
||||
│ │ └── Playlist.java
|
||||
│ └── resources/sbu/javafx/
|
||||
│ ├── player.fxml
|
||||
│ └── style.css
|
||||
└── pom.xml
|
||||
```
|
||||
|
||||
Link your UI elements to the provided `MusicController` class:
|
||||
---
|
||||
|
||||
- Connect buttons to their corresponding controller methods.
|
||||
- Ensure that clicking buttons triggers the correct actions.
|
||||
## Requirements
|
||||
|
||||
**3. Display the Currently Playing Song**
|
||||
- Java 17+
|
||||
- JavaFX 17+
|
||||
- JAudioTagger 3.0.1 (for reading song metadata)
|
||||
|
||||
When a user clicks a **Play** button:
|
||||
---
|
||||
|
||||
- Update a label in the UI showing the currently playing song (e.g., "Now Playing: Song Title").
|
||||
## Dependencies (pom.xml)
|
||||
|
||||
**4. Implement a Playlist**
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-media</artifactId>
|
||||
<version>17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.jthink</groupId>
|
||||
<artifactId>jaudiotagger</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
When the **Add to Playlist** button is clicked:
|
||||
---
|
||||
|
||||
- Add the selected song to a playlist data structure (e.g., an `ArrayList`).
|
||||
## How to Run
|
||||
|
||||
**5. Create a Playlist Page**
|
||||
```bash
|
||||
mvn clean javafx:run
|
||||
```
|
||||
|
||||
Add a **"View Playlist"** button to the main UI:
|
||||
---
|
||||
|
||||
- When clicked, switch to a **new scene** that displays the playlist.
|
||||
- Use `stage.setScene(...)` to switch between scenes.
|
||||
- Show the playlist content using a `ListView` or any other layout.
|
||||
## How to Use
|
||||
|
||||
### Adding Songs
|
||||
1. Go to the **Library** tab
|
||||
2. Click **+ Add Song**
|
||||
3. Select one or more audio files (mp3, wav, aac, flac)
|
||||
4. Songs will appear in the library with their metadata
|
||||
|
||||
## 🎨 UI Design Reference
|
||||
### Playing Songs
|
||||
- Double-click any song in the library to start playing
|
||||
- Use the control buttons to play/pause, skip, or go back
|
||||
- Drag the progress bar to seek
|
||||
|
||||
To help you get started, refer to the layout below. Your application should have a similar, clean, and simple structure:
|
||||
### Playlists
|
||||
1. Go to the **Playlists** tab
|
||||
2. Click **+ New** to create a playlist
|
||||
3. Go back to the Library tab
|
||||
4. Right-click any song and select **Add to Playlist**
|
||||
5. Double-click a playlist to open it
|
||||
6. Double-click a song inside the playlist to play it
|
||||
|
||||

|
||||
### Dark Mode
|
||||
- Click the 🌙 button on the top right of the player panel to toggle dark mode
|
||||
|
||||
*(Note: This is a wireframe. You are encouraged to keep your implementation simple and focus on functionality.)*
|
||||
---
|
||||
|
||||
## Supported Formats
|
||||
|
||||
## ⭐ Bonus Tasks (Optional)
|
||||
|
||||
**The core requirements above do not include actual audio playback.** The following tasks are optional (Bonus) and should only be attempted if you have completed the core requirements.
|
||||
|
||||
**1. Play Functionality**
|
||||
|
||||
- Implement actual audio playback using JavaFX `Media` and `MediaPlayer` classes.
|
||||
|
||||
**2. Add Visual Feedback**
|
||||
|
||||
- When a song is playing, change the row style or update the **Play** button text to "Playing".
|
||||
|
||||
**3. Dark Mode / Light Mode**
|
||||
|
||||
- Add a toggle button to switch between two CSS stylesheets (e.g., `dark.css` and `light.css`) at runtime.
|
||||
| Format | Supported |
|
||||
|--------|-----------|
|
||||
| MP3 | ✅ |
|
||||
| WAV | ✅ |
|
||||
| AAC | ✅ |
|
||||
| FLAC | ✅ |
|
||||
|
||||
---
|
||||
|
||||
## Preview
|
||||

|
||||

|
||||

|
||||

|
||||
Binary file not shown.
|
After Width: | Height: | Size: 112 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
Reference in New Issue
Block a user