add icon to stage
This commit is contained in:
@@ -4,7 +4,9 @@ import javafx.application.Application;
|
|||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class MusicApp extends Application {
|
public class MusicApp extends Application {
|
||||||
@@ -16,7 +18,13 @@ public class MusicApp extends Application {
|
|||||||
Scene scene = new Scene(fxmlLoader.load());
|
Scene scene = new Scene(fxmlLoader.load());
|
||||||
stage.setTitle("Music Player");
|
stage.setTitle("Music Player");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
//TODO: add icon to the stage
|
scene.getStylesheets().add(getClass().getResource("light.css").toExternalForm());
|
||||||
|
stage.setWidth(1100);
|
||||||
|
stage.setHeight(500);
|
||||||
|
|
||||||
|
Image icon = new Image(getClass().getResourceAsStream("icon.png"));
|
||||||
|
stage.getIcons().add(icon);
|
||||||
|
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user