forked from AdvancedProgramming1404/HW-07-JavaFX
45 lines
1.2 KiB
Java
45 lines
1.2 KiB
Java
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
|
|
{
|
|
|
|
FXMLLoader fxmlLoader = new FXMLLoader(
|
|
Objects.requireNonNull(MusicApp.class.getResource("App-view.fxml"),
|
|
"Cannot find App-view.fxml in resources (src/main/resources/sbu/javafx/)")
|
|
);
|
|
|
|
Scene scene = new Scene(fxmlLoader.load(), 520, 300);
|
|
stage.setTitle("Music Player");
|
|
stage.setScene(scene);
|
|
|
|
try
|
|
{
|
|
Image icon = new Image(
|
|
Objects.requireNonNull(MusicApp.class.getResourceAsStream("icon.png"),
|
|
"Cannot find icon.png in resources (src/main/resources/sbu/javafx/)")
|
|
);
|
|
stage.getIcons().add(icon);
|
|
}
|
|
catch (Exception ignored) {}
|
|
|
|
stage.show();
|
|
}
|
|
|
|
public static void main(String[] args)
|
|
{
|
|
launch(args);
|
|
}
|
|
} |