Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: intermittent hang on launch



At 12:04 -0800 30/1/07, Doug Zwick <email@hidden> wrote:

 #15	0x00000034 in javax.swing.JEditorPane.setText() at
 JEditorPane.java:1314

It looks like you are calling setText() from outside the AWT Thread. Although I don't recall whether it is really forbidden, you might want to try to call this from the AWT Thread instead (using SwingWorker or something along these lines). We had several similar problems in our software that were solved by doing GUI thing always in the AWT Thread.

Many Java programs use a main routine something like this:

     public static void main (String[] args) {
         SwingUtilities.invokeLater (new Runnable() {
             public void run() {
                 MyMainFrame frame = new MyMainFrame();
                 frame.pack();
                 frame.show();
             }
         });
     }

That shouldn't be necessary. You are explicitly allowed to call Swing methods from any thread until the component is realized. The problem is thread safety and calls to paint() from the event loop, but the component won't be painted until it's shown. Looing at the original stack trace one would really have to see the code in jmadonna.JMadonna and see what it's done with the GUI prior to creating the document. Also, what does the stack trace for the event loop at that point show?


-Rolf
--
Rolf Howarth
Square Box Systems Ltd
Stratford-upon-Avon UK.
http://www.squarebox.co.uk
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.