On 25.11.2009 13:27, Joonas Pulakka wrote:
Hello,

Swing's thread policy has apparently been getting stricter over years, and as mentioned for example here: http://stackoverflow.com/questions/491323/is-it-safe-to-construct-swing-awt-widgets-not-on-the-event-dispatch-thread 

It's "illegal" to even _construct_ Swing widgets outside the event dispatch thread, let alone manipulate them. In other words, code like this http://jythonpodcast.hostjava.net/jythonbook/chapter16.html works, strictly speaking, only by coincidence, unless the code is explicitly launched on the EDT - and generally it isn't.

This is a pity, since Jython's other features regarding Swing are quite nice, making the code concise and clear. Is there a simple workaround this? Should some "thread safety help" be built into core Jython? How have you people dealt with this issue - building workarounds, or simply Swinging outside the EDT by luck?
Check out my jython-swingutils for a fairly clean solution to this: http://bitbucket.org/agronholm/jython-swingutils/ (particularly the dispatch module).

Best Regards,
Joonas
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Jython-users mailing list Jython-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jython-users