JFXPanel
Artem Ananiev
artem.ananiev at oracle.com
Mon Dec 24 07:17:30 PST 2012
On 12/21/2012 6:54 PM, Scott Palmer wrote:
> The underlying JFXPanels are an implementation detail of how the
> Window is rendered… having per-panel modality built-in seems very
> strange. It's like asking should I block other JButtons on my Swing
> panel after hitting the JButton that brings up my JOptionPane. It
> doesn't make sense, the JOptionPane blocks the entire parent Window,
> no just some small part of it.
>
> The Modality of the dialog is what matters, and as I understand it,
> that relates only to the parent Window and other top-level Windows in
> the application - embedded "windows" don't count because they aren't
> something the user is even supposed to be aware of.
>
> Anyway.. the blocking can be dealt with in the application code if
> need be (make the Dialog modeless and block the panel via other
> means). It isn't even the issue. It is the Window hierarchy that is
> the issue. Dialogs should never go behind their parent window.
> That's the only bug I would be trying to address for now.
FX inside JFXPanel, which is in turn inside a Swing application is the
same model as Java Plugin running in the browser. I don't think we (in
AWT, Glass) use browser's window as the owner of dialogs shown from Java
application, nevertheless we don't have z-order issues (but used to have
in the past).
Another example is AWT modal dialogs. As you know, in AWT a dialog can
block several other windows, not just it's owner. All of the blocked
windows should be below the blocker dialog, and it cannot be solved by
using native means (there may be no more than 1 owner for a window). On
OS X, it's implemented by bringing the dialog to top every time any of
its blocked windows is activated. It's not perfect, but it works. It
would not work very well for temporary (popup) windows, but they are
handled differently, just closed on deactivation.
Right now FX doesn't provide any API to listen for window z-order and
activation changes. Such API would help in some cases, what do you think?
Thanks,
Artem
> Scott
>
> On 2012-12-21, at 8:09 AM, Anthony Petrov <anthony.petrov at oracle.com> wrote:
>
>> It isn't obvious to me, however. Suppose I add several JFXPanels into a single Swing top-level window. I may want to show a modal dialog for the first JFXPanel, but leave others operable, for example. This use case seems to be quite valid.
>>
>> --
>> best regards,
>> Anthony
>>
>> On 12/21/2012 16:09, Scott Palmer wrote:
>>> The whole Swing window must be blocked, if possible. I don't even understand why this is a question. If I show a JOptionPane and I give a JPanel as the "parent" component, does it block only the JPanel? This is no different. Can you give me an example of when you would only want the JFXPanel blocked?
>>> Scott
>>> On 2012-12-21, at 4:52 AM, Anthony Petrov <anthony.petrov at oracle.com> wrote:
>>>> Hi Scott,
>>>>
>>>> I think that technically this could be implemented.
>>>>
>>>> However, there's a problem: when you create a modal FX dialog specifying a JFXPanel instance as its owner - should the whole Swing window be blocked while the dialog is showing, or should the JFXPanel be disabled only? Why?
>>>>
>>>> From logical perspective there's not a perfect answer to the above question. No matter what decision we make, some people could get upset.
>>>>
>>>> --
>>>> best regards,
>>>> Anthony
>>>>
>>>> On 12/21/2012 7:00, 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.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Artem
>>>>> I responded earlier wondering why the native window handle of the Swing Window wasn't acquired via the publicly available jawt native methods so it could be used as the parent for a Stage or worked into some sort of hierarchy to give a proper parent window to FX Stages and dialogs. I didn't see any response. Am I missing something?
>>>>> I already do this (get and use the native window handle) in a Swing app so that I can blit live video into my Swing app., a high-end video capture/transcoder/broadcast application. (See http://www.digitalrapids.com/en/Products/StreamZHD.aspx or the one that really could have used FX if it was ready earlier http://www.digitalrapids.com/en/Products/TouchStream.aspx)
>>>>> I actually have a need to do the same with a JavaFX app .. but there is no equivalent in FX land for the jawt JNI methods. (I asked for this years ago in the Java FX 1.0 days.)
>>>>> Is all of the code involved in JFXPanel->Scene->Window Open Source? I went poking around but didn't find the implementation of com.sun.javafx.tk.quantum.QuantumToolkit which I think is used to create the peer of the EmbeddedWindow used as the Window for JFXPanels.
>>>>> Cheers,
>>>>> Scott
>
More information about the openjfx-dev
mailing list