How to minimize an undeclared stage when you click the icon on the taskbar

I have an undeclared stage. I would like it to be minimized when its icon on the Windows 7 taskbar clicked. How can I achieve this?

public void popStage(Parent view, Dimension d) { Scene scene = new Scene(view); stage.initStyle(StageStyle.UNDECORATED); stage.initStyle(StageStyle.TRANSPARENT); stage.initModality(Modality.WINDOW_MODAL); StageDraggable.stageDraggable(view, stage); stage.getIcons().add(new Image(Resources.getBrickbreaker())); stage.setScene(scene); stage.setWidth(d.getWidth()); stage.setHeight(d.getHeight()); stage.show(); } 
+5
source share
1 answer

You can do something like this.

step 1: create a button as a minimizer wherever you want ( top-right corner will be suitable).

Step 2: set this button to action and write the code,

 stage.setIconified(true); 
0
source

Source: https://habr.com/ru/post/1211394/


All Articles