forked from AdvancedProgramming1404/HW-07-JavaFX
55 lines
2.1 KiB
Java
55 lines
2.1 KiB
Java
package sbu.javafx;
|
|
|
|
import javafx.application.Application;
|
|
import javafx.fxml.FXMLLoader;
|
|
import javafx.scene.Parent;
|
|
import javafx.scene.Scene;
|
|
import javafx.scene.image.Image;
|
|
import javafx.stage.Stage;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class MusicApp extends Application {
|
|
|
|
@Override
|
|
public void start(Stage stage) throws IOException
|
|
{
|
|
FXMLLoader fxmlLoader = new FXMLLoader(MusicApp.class.getResource("App-view.fxml"));
|
|
Parent root = fxmlLoader.load();
|
|
|
|
MusicController controller = fxmlLoader.getController();
|
|
|
|
controller.musicsListView.getItems().addAll(
|
|
new Song("Blinding Lights", "The Weeknd","/musics/The-Weeknd-Blinding-Lights-128.mp3"),
|
|
new Song("Comme des enfants", "Coert De Pirate","/musics/Coeur-De-Pirate-Comme-des-enfants-128.mp3"),
|
|
new Song("Slow Down", "GRAE", "/musics/GRAE-Slow-Down-128.mp3"),
|
|
new Song("Cigarettes out the Window", "TV Girl", "/musics/TV-Girl-Cigarettes-out-the-Window-128.mp3"),
|
|
new Song("deja vu", "Olivia Rodirgo", "/musics/Olivia-Rodrigo-deja-vu-320.mp3"),
|
|
new Song("The Line", "Twoenty One Pilots", "/musics/Twenty-One-Pilots-The-Line-128.mp3"),
|
|
new Song("Bones", "Imagine Dragons", "/musics/Imagine-Dragons-Bones-128.mp3"),
|
|
new Song("Bunker", "Balthazar", "/musics/Balthazar-Bunker-128.mp3"),
|
|
new Song("As It Was", "Harry Styles", "/musics/Harry-Styles-As-It-Was-320.mp3")
|
|
);
|
|
|
|
controller.setupListView(controller.musicsListView);
|
|
controller.setupListView(controller.playlistListView);
|
|
|
|
Scene scene = new Scene(root, 500, 600);
|
|
|
|
scene.getStylesheets().add(
|
|
getClass().getResource("/css/dark.css").toExternalForm()
|
|
);
|
|
|
|
stage.setTitle("Music Player");
|
|
stage.getIcons().add(
|
|
new Image(getClass().getResourceAsStream("/image/icon.png"))
|
|
);
|
|
stage.setScene(scene);
|
|
stage.setResizable(false);
|
|
|
|
//TODO: add icon to the stage
|
|
stage.show();
|
|
}
|
|
|
|
}
|