简体   繁体   中英

Minimising & Maximising Java fx app programmatically

I am creating a custom TitleBar for my application, and i am implementing the Minimise && Maximise && Close buttons for my Stage .. I am achieving that by using the TRANSPARENT StageStyle

i Maximise this way

Stage.setHeight(Screen.getPrimary().getVisualBounds().getHeight()-Margins);
Stage.setWidth(Screen.getPrimary().getVisualBounds().getWidth() -Margins);
Stage.setX(1.0);
Stage.setY(0.0);
// let others know about it

I Close this way

// stop all custom stuffs
Stage.close();

&& I want to Minimise any way to achieve that??

Minimisation is my problem.. Incase of what i have tried, i have tried hide() , toBack() -( which seems to persuade you if you have piles of windows on screen ) and they all do not work

Maximize and de-maximize a JavaFX stage

Use stage.setMaximized(boolean value) .

To maximize:

stage.setMaximized(true);

To restore to the pre-maximized size:

stage.setMaximized(false);

Update for further questions

i want a java way of hiding effect of my app without closing and reopen on demand

Sounds like your question really about how to reduce the application to an icon or restore it from an icon.

Iconify and de-iconify a JavaFX stage

To iconify :

stage.setIconified(true);

To deiconify:

stage.setIconified(false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM