Develop #1

Open
Z.Gharagozloo.M wants to merge 3 commits from develop into main
3 changed files with 20 additions and 33 deletions
Showing only changes of commit 58bc71aeb1 - Show all commits
+1 -1
View File
@@ -5,6 +5,6 @@ import javafx.application.Application;
public class Launcher {
public static void main(String[] args) {
// TODO: Launch the JavaFX application by calling Application.launch(Main.class) }
Application.launch(MusicApp.class, args);
}
}
+19 -6
View File
@@ -3,21 +3,34 @@ 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;
import java.util.Objects;
public class MusicApp extends Application {
@Override
public void start(Stage stage) throws IOException
{
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(MusicApp.class.getResource("App-view.fxml"));
Scene scene = new Scene(fxmlLoader.load());
stage.setTitle("Music Player");
Scene scene = new Scene(fxmlLoader.load(), 600, 550);
stage.setTitle("🎵 Music Player");
try {
Image icon = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/icons/music_icon.png")));
stage.getIcons().add(icon);
} catch (Exception e) {
System.out.println("Icon not found, continuing without icon.");
}
stage.setScene(scene);
//TODO: add icon to the stage
stage.setResizable(false);
stage.show();
}
}
public static void main(String[] args) {
launch(args);
}
}
-26
View File
@@ -1,26 +0,0 @@
package sbu.javafx;
public class Song {
private String title;
private String artist;
private String duration;
public Song(String title, String artist, String duration) {
this.title = title;
this.artist = artist;
this.duration = duration;
}
public String getTitle() { return title; }
public String getArtist() { return artist; }
public String getDuration() { return duration; }
public String getDisplayName() {
return title + " - " + artist + " (" + duration + ")";
}
@Override
public String toString() {
return getDisplayName();
}
}