[API Review] RT-27887: introduce a node to embed Swing into JavaFX

Richard Bair richard.bair at oracle.com
Fri Jan 25 08:30:35 PST 2013

>> I wonder if it's not better to require that the method is called
>> *always* in the swing thread to avoid confusion, I fear that some
>> programmers will construct their swing components outside the EDT, but
>> even worse, I fear this can be taken as some kind of allowance to
>> initialise them, and perhaps in some cases even start them, in the FX
>> dispatching thread.
>> For no reason this consideration should pollute the API, but I guess
>> either requiring that the method is called in the EDT or putting in the
>> JavaDoc that the Swing components still need to follow the usual rules
>> would be a better thing.
> Well, I think we may disallow calling it on FX thread, thus eliminating doubtful options.

I'm actually of the other opinion, that it ought to be callable from the FX thread but not the EDT. The reason is that there is no API presently in FX that cannot be called on the FX thread (some APIs on Service are spec'd to be called by the platform on a different thread, but if you did call it from the FX thread it should still work).

Another thing to think about (and I hope there is a JIRA for it) is that I believe Artem had some ideas around how we could make the FX thread and the EDT the same thread -- maybe by launching the JRE with a command line flag. In that case the distinction would be irrelevant.


More information about the openjfx-dev mailing list