首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

差异Display.getDefault()与Display.getCurrent()

2012-12-18 
区别Display.getDefault()与Display.getCurrent()Display.getDefault(): 该方法会返回用户图形界面线程中

区别Display.getDefault()与Display.getCurrent()

Display.getDefault(): 该方法会返回用户图形界面线程中的Display实例,不管当前线程是否是用户图形界面线程.如果这个实例不存在,默认创建一个用户图形界面线程中的Display实例.

/** * Returns the display which the currently running thread is the * user-interface thread for, or null if the currently running thread is not * a user-interface thread for any display. *  * @return the current display */public static Display getCurrent(){return findDisplay(Thread.currentThread());}

热点排行