After setting an EventHandler to a Stage via setOnHiding(...) the Stage is unconditionally hidden when the handler's handle(...) method returns. IMO the primary purpose of differentiating between onHiding and onHidden is to permit canceling the hiding in the former.
Perhaps this could be implemented by not hiding the Stage if the WindowEvent is consume()d in the onHiding handler, or maybe by providing a defaultCloseOperation as in Swing's top level windows.
The first suggested approach could facilitate conditionally consume()ing a WindowEvent.WINDOW_HIDING in an EventFilter to prevent the window from being closed.
Discussion here: http://forums.oracle.com/forums/thread.jspa?threadID=2245058
db
Perhaps this could be implemented by not hiding the Stage if the WindowEvent is consume()d in the onHiding handler, or maybe by providing a defaultCloseOperation as in Swing's top level windows.
The first suggested approach could facilitate conditionally consume()ing a WindowEvent.WINDOW_HIDING in an EventFilter to prevent the window from being closed.
Discussion here: http://forums.oracle.com/forums/thread.jspa?threadID=2245058
db
- relates to
-
JDK-8101097 No way to cancel Stage closing
- Resolved