66import com .DesktopApplicationClientJava .session .Session ;
77import com .DesktopApplicationClientJava .utils .ControllerWiring ;
88import java .io .IOException ;
9+ import java .io .InputStream ;
10+ import java .util .List ;
911import javafx .application .Application ;
1012import javafx .fxml .FXMLLoader ;
1113import javafx .scene .Parent ;
1214import javafx .scene .Scene ;
15+ import javafx .scene .image .Image ;
1316import javafx .stage .Stage ;
1417
1518public class Program extends Application {
@@ -20,6 +23,9 @@ public class Program extends Application {
2023 private static final double WINDOW_WIDTH = 800.0 ;
2124 private static final double WINDOW_HEIGHT = 600.0 ;
2225
26+ private static final String ICON_BASE = "/images/icons/png/app-" ;
27+ private static final List <Integer > ICON_SIZES = List .of (16 , 32 , 48 , 64 , 128 , 256 );
28+
2329 private final Session session = new Session ();
2430 private final ApiClient apiClient = new ApiClient (session );
2531 private final ServiceRegistry services = createServices ();
@@ -43,6 +49,7 @@ public void start(Stage stage) throws IOException {
4349 Parent root = loader .load ();
4450 Scene scene = new Scene (root );
4551 loadStyleSheet (scene , "/styles.css" );
52+ loadIcons (stage );
4653
4754 stage .setScene (scene );
4855 stage .setTitle ("Госхрон" + (MOCK_DATA ? " [MOCK]" : "" ));
@@ -65,4 +72,16 @@ private void loadStyleSheet(Scene scene, String path) {
6572 scene .getStylesheets ().add (url .toExternalForm ());
6673 }
6774 }
75+
76+ private void loadIcons (Stage stage ) {
77+ for (int size : ICON_SIZES ) {
78+ try (InputStream in = getClass ().getResourceAsStream (ICON_BASE + size + ".png" )) {
79+ if (in != null ) {
80+ stage .getIcons ().add (new Image (in ));
81+ }
82+ } catch (IOException e ) {
83+ System .err .println (e );
84+ }
85+ }
86+ }
6887}
0 commit comments