diff --git a/src/main/java/sbu/javafx/Launcher.java b/src/main/java/sbu/javafx/Launcher.java index c288d10..b66ae9b 100644 --- a/src/main/java/sbu/javafx/Launcher.java +++ b/src/main/java/sbu/javafx/Launcher.java @@ -4,5 +4,7 @@ import javafx.application.Application; public class Launcher{ public static void main(String[] args) { - // TODO: Launch the JavaFX application by calling Application.launch(Main.class) } + // TODO: Launch the JavaFX application by calling Application.launch(Main.class) + Application.launch(MusicApp.class); + } } diff --git a/src/main/java/sbu/javafx/MusicApp.java b/src/main/java/sbu/javafx/MusicApp.java index a50badc..a0c39e6 100644 --- a/src/main/java/sbu/javafx/MusicApp.java +++ b/src/main/java/sbu/javafx/MusicApp.java @@ -16,8 +16,8 @@ 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.show(); + stage.setResizable(false); } } diff --git a/src/main/java/sbu/javafx/Song.java b/src/main/java/sbu/javafx/Song.java index 2847357..5fedfea 100644 --- a/src/main/java/sbu/javafx/Song.java +++ b/src/main/java/sbu/javafx/Song.java @@ -1,4 +1,73 @@ package sbu.javafx; public class Song { + + private String title; + private String artist; + private String album; + private String filePath; + private String coverPath; + private int duration; // seconds + + // Constructor + public Song(String title, String artist, String album, String filePath, String coverPath, int duration){ + this.title = title; + this.artist = artist; + this.album = album; + this.filePath = filePath; + this.coverPath = coverPath; + this.duration = duration; + } + + // ========================================= Getters ============================================ + public int getDuration() { + return duration; + } + public String getCoverPath() { + return coverPath; + } + public String getFilePath() { + return filePath; + } + public String getAlbum() { + return album; + } + public String getArtist() { + return artist; + } + public String getTitle() { + return title; + } + + // ========================================= Setters ============================================ + public void setTitle(String title) { + this.title = title; + } + public void setArtist(String artist) { + this.artist = artist; + } + public void setAlbum(String album) { + this.album = album; + } + public void setFilePath(String filePath) { + this.filePath = filePath; + } + public void setCoverPath(String coverPath) { + this.coverPath = coverPath; + } + public void setDuration(int duration) { + this.duration = duration; + } + + // ========================================= Methods ============================================ + public String formattedDuration(){ + int minutes = duration / 60; + int seconds = duration % 60; + return String.format("%d:%02d)", minutes, seconds); + } + + @Override + public String toString() { + return title + " - " + artist; + } }