JFXPanel

Artem Ananiev artem.ananiev at oracle.com
Tue Dec 18 03:05:55 PST 2012


On 12/17/2012 4:49 PM, Scott Palmer wrote:
> On 2012-12-17, at 5:55 AM, Artem Ananiev <artem.ananiev at oracle.com> wrote:
>
>> On 12/14/2012 8:19 PM, Werner Lehmann wrote:
>>> Scott,
>>>
>>> JFXPanel has quite a few issues (look for JFXPanel or Swing in Jira).
>>> Among those is the filechooser problem. It is probably just one instance
>>> of the problem that a JavaFX stage cannot be modal or on top of Swing
>>> windows.
>>
>> Yes, z-order and modality problems with Swing and FX top-level windows is a known issue. Unfortunately, I don't know a good way to fix it: AWT/Swing doesn't expose enough information to use its windows as owner windows for other UI toolkits.
>
> Not on the Java side, but it does if you use JNI...  jawt.h has enough information to get the native window handle.

JAWT may help in some cases. However, on some platforms Swing and FX use 
different underlying toolkits and widgets, e.g. Xlib and GTK, CALayer 
and NSView. I hope GTK should accept Xlib's Window as a parent (I'm not 
an expert in either, though), but I still can't say for sure how robust 
such combinations will be.

Modality is even more interesting than owner window - owned window 
relationship. What does it mean to have a dialog modal to a child 
(embedded) window? Should child's parent window be blocked? Imagine a 
browser window with multiple tabs blocked by a dialog shown by one of 
the plugins...

> In fact I wanted the equivalent of jawt.h for JavaFX windows as without it we lose the ability to render directly into windows of the java app. I need to effectively do a video overlay.

I haven't heard of any plans about JAWT (JFXWT:)) for JavaFX windows.

Thanks,

Artem

> Scott
>
>>
>> Thanks,
>>
>> Artem
>>
>>> To work around this we have to put JFXPanels in JDialogs. Not really
>>> sexy: apart from the overhead in code we know today that we have to
>>> touch this again one day to convert the JDialog to a stage.
>>>
>>> Regarding your problem of how to get from a node to the JFXPanel: no
>>> idea why you would want to do this. I have a dozen jfxpanels but never
>>> needed such a thing. I guess you could extend JFXPanel and add a
>>> reference to the fxpanel to some userdata on a node, or something like
>>> that.
>>>
>>> Rgds
>>> Werner
>>>
>>> On 14.12.2012 16:39, Scott Palmer wrote:
>>>> I'm trying to migrate more of my app from Swing to JavaFX piece-wise
>>>> via JFXPanels.  It's not fun as there are many rough edges.  In order
>>>> to work around some of them I am wondering if it is possible to get a
>>>> reference to the JFXPanel if all I have is a Node? I can get the
>>>> Scene's Window, an "Embedded" Window that seems to be the root of a
>>>> lot of problems with popups and dialogs.  That seems to be enough to
>>>> determine that the Node is hosted by a JFXPanel, but can I actually
>>>> get the JFXPanel instance?
>>>>
>>>> If there is a way via public APIs that don't rely on me peaking at
>>>> implementation details like com.sun.javafx.stage.EmbeddedWindow?
>>>>
>>>> Along this line… why is it that things like the FileChooser and other
>>>> JavaFX dialogs don't respect the window ordering when used from a
>>>> JFXPanel? They easily flip behind the parent JFrame.  I would have
>>>> thought that the correct Window hierarchy in native land could still
>>>> include the native window of the JFrame and that should prevent such
>>>> things.
>>>>
>>>> Scott
>>>


More information about the openjfx-dev mailing list