| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Rolf Howarth wrote:
At 12:04 -0800 30/1/07, Doug Zwick <email@hidden> wrote:
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.
public static void main (String[] args) {
final MyMainFrame frame = new MyMainFrame(); SwingUtilities.invokeLater (new Runnable() {
public void run() {
frame.pack();
frame.show();
}
});
}| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.