Thoughts on Dialogs and Lightboxes
zonski at googlemail.com
Fri Mar 30 20:50:20 PDT 2012
I'm curious what the plans are for Dialogs in JavaFX. I assume they are on the roadmap?
I notice hints of this from Jonathon here: http://javafx-jira.kenai.com/browse/RT-12643
But I see the request is as yet unresolved.
The reason I ask is because I've had to implement my own 'Lightbox' framework for my last project and I'm wondering if some part of this or something similar should be in JFX. I know a lot of people on the forums have been looking for classic dialog support from JFX.
If you don't know already, a Lightbox is the web's answer to Dialogs, where a dialog-like pane is layered on top of the main content with a semi-transparent glass pane making it basically modal. The dialog is still within the main browser window, so it's not a true Popup but to the user is much the same.
The end result looks like this:
It is quite easy to implement this in JFX using a StackPane as the base. The simple API is just to have some kind of LightboxPane (or RootPane, etc) that extends StackPane and includes a method like:
This then adds a 'glass pane' to the top of the Stack to dim out the content, and then adds the node to this glass pane. The node's visibility could be tracked to determine when to remove the glass pane, etc.
The API can be extended beyond this simple setup quite drastically to include things like decorated boxes (title bar, close button, resize edges, etc), animated entry/exit, and 'dialog options' such as ok, cancel (ie JOptionPane like functions).
My stuff needs cleaning up but I was planning to eventually roll my framework into JFX Flow. If it's on the JFX roadmap anyway, better not to, or at least I'd like the API to mirror JFX Dialogs if possible.
Thoughts and comments?
More information about the openjfx-dev