Skip to content

Commit da092ca

Browse files
committed
Play with it
* Doesn't seem to work correctly on Ubuntu?
1 parent 5226478 commit da092ca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/de/felixroske/jfxsupport/AbstractJavaFxApplicationSupport.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import javafx.application.Application;
77
import javafx.scene.Scene;
8+
import javafx.scene.image.Image;
89
import javafx.stage.Stage;
910

1011
/**
@@ -20,7 +21,9 @@ public abstract class AbstractJavaFxApplicationSupport extends Application {
2021

2122
private static Stage stage;
2223
private static Scene scene;
23-
24+
25+
protected static Image icon;
26+
2427
public static Stage getStage() {
2528
return stage;
2629
}
@@ -32,6 +35,7 @@ public static Scene getScene() {
3235
@Override
3336
public void init() throws Exception {
3437
applicationContext = SpringApplication.run(getClass(), savedArgs);
38+
icon = new Image(getClass().getResource("/icon.png").toExternalForm());
3539
}
3640

3741
@Override
@@ -42,6 +46,7 @@ public void start(Stage stage) throws Exception {
4246

4347
public static void showView(Class<? extends AbstractFxmlView> newView) {
4448
AbstractFxmlView view = applicationContext.getBean(newView);
49+
4550
stage.titleProperty().bind(view.titleProperty());
4651
if (scene == null) {
4752
scene = new Scene(view.getView());
@@ -51,6 +56,7 @@ public static void showView(Class<? extends AbstractFxmlView> newView) {
5156
}
5257

5358
// stage.setTitle(windowTitle);
59+
stage.getIcons().add(icon);
5460
stage.setScene(scene);
5561
// stage.setResizable(true);
5662
// stage.centerOnScreen();

0 commit comments

Comments
 (0)