JFXPanel
Jonathan Giles
jonathan.giles at oracle.com
Thu Jan 3 09:51:57 PST 2013
I've been wanting to do a JOptionPane-esque feature for JavaFX since at
least 2.0 :-) As it happens I tend to include it in developer previews
in the hope it'll be accepted, but I never seem to get any traction on
it :-) So, for JavaFX 8.0 developer previews, refer to
com.preview.javafx.scene.control.Dialogs for your JOptionPane-esque
requirements. I must warn that I've not got permission to make this into
public API, so it will more than likely be removed from JavaFX 8.0
before it ships, unfortunately.
If you're using JavaFX 2.x, then you'll want to use the backport of my
Dialogs class that has been done by Marco Jakob here:
http://edu.makery.ch/blog/2012/10/30/javafx-2-dialogs/
-- Jonathan
On 4/01/2013 5:58 a.m., Scott Palmer wrote:
> Yes.. I have to look again at JFXtras, to see what they already offer, but I see a need for something like a JavaFX version of JOptionPane. That way you get those default OK/Cancel buttons, the dialog result, etc.
> So far I'm implementing tiny bits on demand, but I need to revisit the whole problem and refactor the code. Dealing with Swing and JavaFX simultaneously can get messy which is why I'm trying got migrate my entire application as soon as practical. There still isn't a 1:1 match in JavaFX for things we are using in Swing, and JavaFX is young enough that there are still many rough edges.
>
> Scott
>
> On 2013-01-03, at 5:28 AM, Werner Lehmann <lehmann at media-interactive.de> wrote:
>
>> Hi Scott,
>>
>> makes sense. I have to keep that in mind for next time. I guess there also has to be some code for common dialog tasks, e.g.
>>
>> - show dialog centered on app or on parent window
>> - modal or modeless
>> - standard handling of ok/cancel/etc buttons (e.g. know when to close the dialog)
>> - data validation before close
>> - pass a dialog result to the caller
>>
>> This is not rocket science but I very much would like to see some standard API for that. Maybe it even makes sense to have skeleton JDialog/Stage classes which bring their own set of buttons. Otherwise you have this ok button in the JFXPanel node but the JDialog does not know when it was clicked.
>>
>> Werner
>>
>> On 02.01.2013 20:06, Scott Palmer wrote:
>>> I intend to pursue this by creating some helper methods to show a
>>> dialog containing a single Parent node. Depending on the parent
>>> object for the dialog it would automatically wrap the node in a
>>> JFXPanel and use a JDialog, or use a Stage. That way I keep the ugly
>>> stuff in one place and don't have to revisit all those dialogs.
More information about the openjfx-dev
mailing list