add icon to stage

This commit is contained in:
2026-05-28 16:57:16 +03:30
parent 5db8791eae
commit 86ea560cc5
+9 -1
View File
@@ -4,7 +4,9 @@ import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.image.Image;
import java.awt.*;
import java.io.IOException;
public class MusicApp extends Application {
@@ -16,7 +18,13 @@ public class MusicApp extends Application {
Scene scene = new Scene(fxmlLoader.load());
stage.setTitle("Music Player");
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();
}