5
5
6
6
import javafx .application .Application ;
7
7
import javafx .scene .Scene ;
8
+ import javafx .scene .image .Image ;
8
9
import javafx .stage .Stage ;
9
10
10
11
/**
@@ -20,7 +21,9 @@ public abstract class AbstractJavaFxApplicationSupport extends Application {
20
21
21
22
private static Stage stage ;
22
23
private static Scene scene ;
23
-
24
+
25
+ protected static Image icon ;
26
+
24
27
public static Stage getStage () {
25
28
return stage ;
26
29
}
@@ -32,6 +35,7 @@ public static Scene getScene() {
32
35
@ Override
33
36
public void init () throws Exception {
34
37
applicationContext = SpringApplication .run (getClass (), savedArgs );
38
+ icon = new Image (getClass ().getResource ("/icon.png" ).toExternalForm ());
35
39
}
36
40
37
41
@ Override
@@ -42,6 +46,7 @@ public void start(Stage stage) throws Exception {
42
46
43
47
public static void showView (Class <? extends AbstractFxmlView > newView ) {
44
48
AbstractFxmlView view = applicationContext .getBean (newView );
49
+
45
50
stage .titleProperty ().bind (view .titleProperty ());
46
51
if (scene == null ) {
47
52
scene = new Scene (view .getView ());
@@ -51,6 +56,7 @@ public static void showView(Class<? extends AbstractFxmlView> newView) {
51
56
}
52
57
53
58
// stage.setTitle(windowTitle);
59
+ stage .getIcons ().add (icon );
54
60
stage .setScene (scene );
55
61
// stage.setResizable(true);
56
62
// stage.centerOnScreen();
0 commit comments