Re: [問題] EventQueue.invokeLater 使用疑問

作者: sbrhsieh (十年一夢)   2015-04-29 22:00:11
※ 引述《noapaov (單身漢)》之銘言:
: 標題: [問題] EventQueue.invokeLater 使用疑問
: 時間: Wed Apr 29 11:59:43 2015
:
:
: 請教一下各位, 目前在Swing碰到一個疑問,
:
: 看了大多數的書籍, 在使用Swing建議使用方法如下
: public static void main(String args[]) {
:
: java.awt.EventQueue.invokeLater(new Runnable() {
: public void run() {
:
: System.out.println("test");
: new NewJFrame().setVisible(true);
: }
: });
: }
:
: 也就是視窗程式會開一個thread來處理Event Queue和GUI的事情,
:
: 但我是用下列方法一樣會產生該視窗物件, 也沒發生什麼錯誤
:
: public static void main(String args[]) {
: new NewJFrame().setVisible(true);
:
: }
:
: 想請問各位大大, 這兩著到底差別在哪? 謝謝
:
:

Links booklink

Contact Us: admin [ a t ] ucptt.com