So I found a workaround, though I don't understand the why of the problem or
workaround.
What I found was that on MacOSX 7u25+, my app mainSwing() (executed via
invokeLater() from main()) was being called on AWT-EventQueue-2 from the JAWS
startup thread (javawsApplicationMain) instead of AWT-EventQueue-0. So I added
code to force JavaFX init, switch over to the FX thread, and switch back to
Swing, which is then AWT-EventQueue-0:
if(Thread.currentThread().getName().equals("AWT-EventQueue-2")) {
new JFXPanel();
Platform.runLater(new Runnable() { public void run() {
SwingUtilities.invokeLater(new Runnable() { public void
run() {
mainSwing(args); }}); }});
return;
}
And now my JOptionPane correctly blocks events outside of the dialog!
jeff
On Aug 8, 2013, at 9:56 AM, Jeff Martin <[email protected]> wrote:
> Addendum: it turns out that the JOptionPane is not blocking any of the UI
> (Swing included). So maybe this isn't strictly a JavaFX problem.
>
> jeff
>
>
> On Aug 8, 2013, at 8:17 AM, Jeff Martin <[email protected]> wrote:
>
>> It looks like this is specific to MacOSX 7u25+, if you run Java Inventor
>> from the JAWS link on MacOSX (I'm using JVM 1.7.0_25 or 40-ea):
>>
>> prompt> javaws http://reportmill.com/javi/javi1/JavaInventor1.jnlp
>>
>> Here are the steps:
>>
>> 1. Create New Project and Open
>> 2. Click on large, animated "New Java Starter File" to bring up
>> JOptionPane
>>
>> Then if you move the mouse around, you should see the other buttons on the
>> screen still animate or illuminate in the FX thread. Whereas on 7u20 or
>> Windows or non-JAWS launch, the JavaFX effects are not triggered while the
>> modal panel is up. If you dismiss the option pane with the escape key and
>> quickly re-click the New Starter File button repeatedly, eventually the
>> SwingUtilities.computeIntersection NPE will manifest (sooner if you are
>> doing a sales demo).
>>
>> Any thoughts on what would make the FX thread ignore the modal state in this
>> configuration?
>>
>> jeff
>>
>>
>> On Aug 8, 2013, at 6:50 AM, Artem Ananiev <[email protected]> wrote:
>>
>>>
>>> On 8/8/2013 1:45 AM, Jeff Martin wrote:
>>>> I thought I was getting this automatically - when I run on my
>>>> desktop, I can bring up a JOptionPane from a Swing thread and
>>>> JFXPanels (correctly) block. But when I run from Java Web Start, they
>>>> don't, and I end up with sporadic SwingUtilities.computeIntersection
>>>> NullPointerException.
>>>
>>> Once these two JDK/JavaFX bugs are resolved, scenario with JOptionPane you
>>> described will work. As I wrote, it won't work by default in JDK8, you'll
>>> need to run your app with certain system property (something like
>>> -Djavafx.swing.singlethreaded=true).
>>>
>>>> Is there a secret setting that has a different default with JAWS?
>>>
>>> NPEs look like a bug, either in AWT/FX, or in your application. I really
>>> doubt it's related to Java Web Start. Could you provide a test to reproduce
>>> the exceptions, please?
>>>
>>> Thanks,
>>>
>>> Artem
>>>
>>>> jeff
>>>>
>>>>
>>>> On Aug 7, 2013, at 5:06 AM, Artem Ananiev <[email protected]> wrote:
>>>>
>>>>> Hi, Pedro Duque Vieira,
>>>>>
>>>>> this is in progress. JDK part is tracked in 8015477:
>>>>>
>>>>> http://bugs.sun.com/view_bug.do?bug_id=8015477
>>>>>
>>>>> JavaFX part is described in RT-30694:
>>>>>
>>>>> https://javafx-jira.kenai.com/browse/RT-30694
>>>>>
>>>>> Note that in JDK8/JavaFX8 single-threaded mode will not be a part of
>>>>> public API, it will be an experimental feature.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Artem
>>>>>
>>>>> On 8/7/2013 2:43 AM, Pedro Duque Vieira wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Some time ago there was a patch submitted which for all purposes merged
>>>>>> the
>>>>>> swing and javafx thread, making it easier for developers working on a
>>>>>> swing/javafx app - http://wiki.apidesign.org/wiki/JavaFX
>>>>>>
>>>>>> Is this available now (I was under the impression it is)? How do I use
>>>>>> it?
>>>>>>
>>>>>> Thanks in advance,
>