diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/sbu/javafx/Launcher.java b/src/main/java/sbu/javafx/Launcher.java
index c288d10..7eba3e7 100644
--- a/src/main/java/sbu/javafx/Launcher.java
+++ b/src/main/java/sbu/javafx/Launcher.java
@@ -2,7 +2,8 @@ package sbu.javafx;
import javafx.application.Application;
-public class Launcher{
+public class Launcher {
public static void main(String[] args) {
- // TODO: Launch the JavaFX application by calling Application.launch(Main.class) }
-}
+ Application.launch(MusicApp.class);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/sbu/javafx/MusicApp.java b/src/main/java/sbu/javafx/MusicApp.java
index a50badc..3dc187e 100644
--- a/src/main/java/sbu/javafx/MusicApp.java
+++ b/src/main/java/sbu/javafx/MusicApp.java
@@ -3,6 +3,7 @@ package sbu.javafx;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
+import javafx.scene.image.Image;
import javafx.stage.Stage;
import java.io.IOException;
@@ -16,7 +17,7 @@ public class MusicApp extends Application {
Scene scene = new Scene(fxmlLoader.load());
stage.setTitle("Music Player");
stage.setScene(scene);
- //TODO: add icon to the stage
+ stage.getIcons().add(new Image(MusicApp.class.getResourceAsStream("music.png")));
stage.show();
}
diff --git a/src/main/java/sbu/javafx/MusicController.java b/src/main/java/sbu/javafx/MusicController.java
index 5da27a9..cbf6d6c 100644
--- a/src/main/java/sbu/javafx/MusicController.java
+++ b/src/main/java/sbu/javafx/MusicController.java
@@ -1,31 +1,77 @@
package sbu.javafx;
-import javafx.fxml.FXML;
import javafx.event.ActionEvent;
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Node;
+import javafx.scene.Scene;
import javafx.scene.control.Label;
-import javafx.scene.input.MouseEvent;
-import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+import java.io.IOException;
+import java.util.ArrayList;
public class MusicController {
- // TODO: Define your UI components using the @FXML annotation.
+ @FXML
+ private Label nowPlayingLabel;
- //TODO: Implement the logic to play a song. This method should update the UI to show which song is currently playing.
+ public static ArrayList playlist = new ArrayList<>();
@FXML
- public void handlePlayAction() {
- //Update labels, change button icons, etc.
+ private void playSong1() {
+ handlePlayAction("Song of Dawn");
}
- //TODO: Logic to add a specific song to the user's playlist.
+ @FXML
+ private void playSong2() {
+ handlePlayAction("Midnight Drive");
+ }
+
+ @FXML
+ private void playSong3() {
+ handlePlayAction("Echoes of You");
+ }
+
+ public void handlePlayAction(String songName) {
+ nowPlayingLabel.setText("Now Playing: " + songName);
+ }
+
+ @FXML
+ private void addSong1() {
+ addToPlaylist("Song of Dawn - Alice Johnson");
+ }
+
+ @FXML
+ private void addSong2() {
+ addToPlaylist("Midnight Drive - The Night Owls");
+ }
+
+ @FXML
+ private void addSong3() {
+ addToPlaylist("Echoes of You - Luna Sky");
+ }
public void addToPlaylist(String songName) {
- //Add the song to a list or update a ListView.
+ if (!playlist.contains(songName)) {
+ playlist.add(songName);
+ }
}
- // TODO:This method should open a new window or change the current scene to display the "Playlist" page.
- public void openPlaylistWindow() {
- //Create a new stage and show the playlist UI.
+ @FXML
+ private void handleOpenPlaylist(ActionEvent event) {
+ openPlaylistWindow(event);
}
-}
+
+
+ public void openPlaylistWindow(ActionEvent event) {
+ try {
+ Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
+ FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("playlist-view.fxml"));
+ Scene scene = new Scene(fxmlLoader.load(), 400, 400);
+ stage.setScene(scene);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/sbu/javafx/PlaylistController.java b/src/main/java/sbu/javafx/PlaylistController.java
new file mode 100644
index 0000000..4e00682
--- /dev/null
+++ b/src/main/java/sbu/javafx/PlaylistController.java
@@ -0,0 +1,34 @@
+package sbu.javafx;
+
+import javafx.event.ActionEvent;
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Node;
+import javafx.scene.Scene;
+import javafx.scene.control.ListView;
+import javafx.stage.Stage;
+import java.io.IOException;
+
+public class PlaylistController {
+
+ @FXML
+ private ListView playlistListView;
+
+ @FXML
+ public void initialize() {
+ playlistListView.getItems().addAll(MusicController.playlist);
+ }
+
+ @FXML
+ private void handleBackButton(ActionEvent event) {
+ try {
+ Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
+
+ FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("App-view.fxml"));
+ Scene scene = new Scene(fxmlLoader.load());
+ stage.setScene(scene);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/sbu/javafx/App-view.fxml b/src/main/resources/sbu/javafx/App-view.fxml
index 306c8d3..efd0348 100644
--- a/src/main/resources/sbu/javafx/App-view.fxml
+++ b/src/main/resources/sbu/javafx/App-view.fxml
@@ -1,8 +1,56 @@
+
+
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/sbu/javafx/music.png b/src/main/resources/sbu/javafx/music.png
new file mode 100644
index 0000000..bc43891
Binary files /dev/null and b/src/main/resources/sbu/javafx/music.png differ
diff --git a/src/main/resources/sbu/javafx/playlist-view.fxml b/src/main/resources/sbu/javafx/playlist-view.fxml
new file mode 100644
index 0000000..4cfae10
--- /dev/null
+++ b/src/main/resources/sbu/javafx/playlist-view.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file