This content has been marked as final. Show 6 replies
How can I control the minimize, maximize and close buttons that are found in the upper left corner of a window in Windows, Mac and LINUX environments?If you use a standard DECORATED stage in JavaFX 2.2, you cannot control these buttons at all.
You can use an UNDECORATED or TRANSPARENT stage and create your own buttons within your JavaFX scene, then you will have complete control over them.
For more information, see:
And the JavaFX Ensemble application (run as a standalone application, not as a browser embedded app), which provides examples of this:
If you go the UNDECORATED stage with your own button route, you may also want to look at the FXExperience Canned Animation package which can add a nicely styled animated effect to the button to indicate whether a file has been saved or not.
FX needs better control over a DECORATED stage. Has such a request been filed?In a way, see:
http://javafx-jira.kenai.com/browse/RT-21508 "Support rendering on top of native window decorations"
http://javafx-jira.kenai.com/browse/RT-21509 "Support areas with native rendering"
http://javafx-jira.kenai.com/browse/RT-20020 "Windows: support Aero Glass effects for top-level windows"
If not, how can I file one?https://forums.oracle.com/forums/ann.jspa?annID=1713 "Announcement: How to file a bug or submit a feature request"
I had a question going in the same direction: "Is there any way to disable the close button in a decorated stage?" but from your answer to the previous question, I guess this is not possible... could you please confirm this?
If you use a standard DECORATED stage in JavaFX 2.2, you cannot control these buttons at all.My application uses a service to load data in a database and I would like to disable the close button while the service is running. I wanted to bind the button disable property to the service state, but could not find a way to get the button.
A workaround would be to set an event handler to consume the window close event. Looks like I'll need to go that way. Or could you suggest a better way?
I had a question going in the same direction: "Is there any way to disable the close button in a decorated stage?" but from your answer to the previous question, I guess this is not possible... could you please confirm this? A workaround would be to set an event handler to consume the window close event. Looks like I'll need to go that way. Or could you suggest a better way?I don't think it's possible with to disable the button in JavaFX 2.2 - if you did, it would provide an inconsistent native windowing experience for the user anyway as I've never seen a close button on a Windows 7 app disabled.
However, as you point out, you can capture (and handle or ignore) the events if generated. You can do this by setting an onCloseRequest event handler for the window and calling event.consume() in the handler. (relevant javadoc comment):
Called when there is an external request to close this Window. The installed event handler can prevent window closing by consuming the received event.------
You could check out my related answer at StackOverflow: http://stackoverflow.com/questions/12874664/javafx-entirely-customized-windows, for some other thoughts on this on customizing decorated and undecorated windows, but I think most has already been said in this thread.