学海拾遗

生活、技术、思想无处不在学习
posts - 52, comments - 23, trackbacks - 0, articles - 3
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Java Tutorial,学到了一点

Posted on 2007-03-17 00:28 tanzek 阅读(270) 评论(0)  编辑  收藏
一直很奇怪为什么Eclipse中的Visual Editor在进行代码生成时,用的方法是新建一个线程类来调用界面显示函数。
今天在查看Java Tutorial时,也看到了这个:
 1public 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
同时还很重要地注意到了在它中间还有一句注释:
        //Schedule a job for the event-dispatching thread:
        
//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. 

只有注册用户登录后才能发表评论。


网站导航: