一直很奇怪为什么Eclipse中的Visual Editor在进行代码生成时,用的方法是新建一个线程类来调用界面显示函数。
今天在查看Java Tutorial时,也看到了这个:
再细细一想,想一想MVC模型,呵呵,倒是真的发现点了东西了。
看样子这个Tutorial会越看越有劲了!~
菜鸟初次抓笔,请勿见笑哦!~
后注:
第一个例子,在Java的评注中是:
今天在查看Java Tutorial时,也看到了这个:
1
public
static
void
main(String[] args)
{
2 //Schedule a job for the event-dispatching thread:
3 //creating and showing this application's GUI.
4 javax.swing.SwingUtilities.invokeLater(new Runnable() {
5 public void run() {
6 createAndShowGUI();
7 }
8 });
9 }
10
同时还很重要地注意到了在它中间还有一句注释:
2 //Schedule a job for the event-dispatching thread:
3 //creating and showing this application's GUI.
4 javax.swing.SwingUtilities.invokeLater(new Runnable() {
5 public void run() {
6 createAndShowGUI();
7 }
8 });
9 }
10
//
Schedule a job for the event-dispatching thread:
// creating and showing this application's GUI.
这两句话,表面意思就是:调用一个事件分派线程:创建和显示这个应用界面。(翻译不是很准确,请见谅!)
// creating and showing this application's GUI.
再细细一想,想一想MVC模型,呵呵,倒是真的发现点了东西了。
看样子这个Tutorial会越看越有劲了!~
菜鸟初次抓笔,请勿见笑哦!~
后注:
第一个例子,在Java的评注中是:
1
、Import the pertinent packages.
2 、Set up a top - level container.
3 、Display the container.
4 、Be thread - safe.
2 、Set up a top - level container.
3 、Display the container.
4 、Be thread - safe.