Re: Coding Challenge



Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx> wrote:
> Newbies often bring problems to the table that suggest they have done
> something to tie up the swing thread either by giving it some lengthy
> task in an event handler or even going to sleep.
>
> 1. What I would like is something a newbie could tack onto pretty
> well any GUI app that can detect that, and perhaps even diagnose where
> it is happening.
>
> 2. this one is more difficult. People often poke Swing components
> from the non Swing thread. How could you create a wrapper around all
> the Swing components to detect that abuse in a way even a newbie
> could use it? Perhaps there is a way using the JXTA debug interface
> to pull it off in Java.

This is one of the few places where AOP sounds interesting. AOP could
be used to solve SOME of #1 (intercept uses of certain blocking APIs
from the EDT) and pretty much all of #2 (intercept calls to Swing
components outside of the EDT) at runtime. Of course, building the
rules for #2 could be tedious, as you'd need to go through all of Swing
and determine the rules for when it is/isn't safe to access something
through a non-EDT thread.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
.



Relevant Pages

  • Re: Best way to force a JComponent to repaint itself
    ... perspective of a user of Swing that is more concerned with doing ... Since a Swing component does not seem to me to really be a kind of AWT ... component (would a JButton work properly in an AWT Frame? ... The Swing components are built on top of the AWT system, ...
    (comp.lang.java.programmer)
  • Re: How to update Gui data from application code?
    ... > So what is the proper way then to update your swing components from your ... You don't update the GUI directly. ... For more, see the Swing architecture article in Sun's TSC collection, ... and more advanced GUI questions to comp.lang.java.gui. ...
    (comp.lang.java.programmer)
  • Re: EDT: advanced question regarding whats legal/not
    ... To avoid the possibility of deadlock, you must take extreme care ... queried only from the event-dispatching thread. ... Note that it mentions models specifically, even though all Swing models ...
    (comp.lang.java.gui)
  • Re: danger JLabel.settext() in another thread
    ... >other than the event dispatching thread. ... Unlike the AWT, Swing is not threadsafe. ... with Swing components, or their backing data models from a second ... Coaching, problem solving, economical contract programming. ...
    (comp.lang.java.programmer)
  • JOGL stereo and Swing
    ... I am using it to display a stereo pair ... Life is wonderful, except that the ... Swing components that share the JFrame appear only ...
    (comp.lang.java.gui)