Thoughts on Dialogs and Lightboxes
Artem Ananiev
artem.ananiev at oracle.com
Mon Apr 2 04:03:10 PDT 2012
Hi, Daniel,
On 3/31/2012 7:50 AM, Daniel Zwolenski wrote:
> I'm curious what the plans are for Dialogs in JavaFX. I assume they are on the roadmap?
both dialogs (owned windows) and modality are already there:
javafx.stage.Stage#initOwner()
javafx.stage.Stage#initModality()
> I notice hints of this from Jonathon here: http://javafx-jira.kenai.com/browse/RT-12643
This issue is about having the Alert class, which is similar to Swing's
JOptionPane, Windows' MessageBox and similar dialogs in other UI
toolkits. You can implement it yourself, however this functionality is
common enough to be a standard JFX class.
> 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:
>
> http://okonet.ru/projects/modalbox/images/screenshot.jpg
This is a screenshot with Mac OS X "sheet", which is not what is usually
referred to as "Dialog". It's not a separate top-level window. Other
platforms don't have built-in support for such UI elements.
> 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:
>
> showInLightbox(Node node)
>
> 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?
If you're asking about support for Mac OS X "sheets", please, file a
separate JIRA issue about this (I don't know if we already have this
request in FX bug database), as it is completely separate from RT-12643.
Thanks,
Artem
More information about the openjfx-dev
mailing list