`
yeshaoting
  • 浏览: 684284 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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

阅读更多

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

/**
 * Returns the default display. One is created (making the thread that
 * invokes this method its user-interface thread) if it did not already
 * exist.
 * 
 * @return the default display
 */
public static Display getDefault()
{
	synchronized (Device.class)
	{
		if (Default == null)
			Default = new Display();
		return Default;
	}
}



Display.getCurrent(): 返回当前线程中的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());
}
分享到:
评论

相关推荐

    ZendFramework中文文档

    14.1.3. 使用静态 get() 方法 14.2. 标准过滤器类 14.2.1. Alnum 14.2.2. Alpha 14.2.3. BaseName 14.2.4. Digits 14.2.5. Dir 14.2.6. HtmlEntities 14.2.7. Int 14.2.8. RealPath 14.2.9. StringToLower...

    python3.6.5参考手册 chm

    Bootstrapping pip By Default Documentation Changes PEP 446: Newly Created File Descriptors Are Non-Inheritable Improvements to Codec Handling PEP 451: A ModuleSpec Type for the Import System ...

    servlet2.4doc

    Called by the server (via the service method) to allow a servlet to handle a GET request. doHead(HttpServletRequest, HttpServletResponse) - Method in class javax.servlet.http.HttpServlet Receives an...

    php.ini-development

    Current working directory (except CLI) ; 5. The web server's directory (for SAPI modules), or directory of PHP ; (otherwise in Windows) ; 6. The directory from the --with-config-file-path compile ...

    swt资源释放问题

    Display 实例的创建可以使用 getDefault() 方法,第一次调用将创建一个新的 Display 实例,后续调用将获取已经创建的 Display 实例。getCurrent() 方法可以获取当前线程对应的 Display 实例。 需要注意的是,一个...

    fastboot 2020年 android10版本 ubuntu linux平台

    non-current slot (default: current active slot). --set-active[=SLOT] Sets the active slot before rebooting. --skip-secondary Don't flash secondary slots in flashall/update. --skip-reboot Don't ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX The current scale ignores in TFlexBox.GetRefreshRect and TFlexEllipse.GetRefreshRect methods for pen width calculation. - FIX The method TFlexText.GetRefreshRect don't takes into account the ...

    jquery需要的所有js文件

    this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0]...

    C#获取安装软件信息

    InitialSessionState initialSessionState = InitialSessionState.CreateDefault(); using (PowerShell powershell = PowerShell.Create(initialSessionState)) { powershell.AddCommand("Get-AppxPackage"); ...

    C 语言编缉神经网络工具

    NEURAL NETWORK PC TOOLS SOFTWARE USER'S ... present in the file, the current version of hinton.exe does not portray the bias weights. This will be changed in the next version of hinton.exe. ...

    WPTools.v6.29.1.Pro

    - change in RTF reader to let section inherit the default layout, not the current page layout - fix of problem with table borders when also PageMirror was used. * change to DeleteMarkedChar. It now ...

    C#DataGridView中的常用技巧

    Get the Selected Cells, Rows, and Columns in the Windows Forms DataGridView Control Samples: 见msdn。 10、显示录入时出现的错误信息 Handle Errors that Occur During Data Entry in the Windows Forms ...

    2009 达内Unix学习笔记

    与加权限不一样,赋权限有覆盖的效果。 主要形式有如下几种 chmod u+rw chmod u=rw chmod u+r, u+w chmod u+rw,g+w, o+r chmod 777( 用数字的方式设置权限是最常用的) 数字表示权限时,各数位分别表示属主、属...

    Senfore_DragDrop_v4.1

    * Asynchronous targets appears to be broken in the current release. * When TDropFileTarget.GetDataOnEnter is set to True, the component doesn't work with WinZip. Although the file names are ...

    vbs获取软件列表.zip

    objReg.GetStringValue strKeyPath, arrSubKeys(i), "DisplayName", strAppName objReg.GetStringValue strKeyPath, arrSubKeys(i), "DisplayVersion", strAppVersion If strAppName <> "" And strAppVersion ...

    EhLib 6.3 Build 6.3.176 Russian version. Full source included.

    specify macros for current page, current date, current time and/or static text. Automatically print/preview multiselected area of TDBGridEh if it area is not empty. Ability to print/preview ...

    端口查看工具

    o Fixed bug: CurrPorts failed to display the current Auto Refresh status in Menu. * Version 1.40: o Added support for IPv6. * Version 1.37: o Fixed bug: CurrPorts failed to display process ...

    BURNINTEST--硬件检测工具

    - A printer to run the printer test, set-up as the default printer in Windows. - A CD ROM + 1 Music CD or Data CD to run the CD test. - A CD-RW to run the CD burn test. - A network connection and the ...

    Dundas.Chart.for.Winform.Enterprise.v7.1.0.1812.for.VS2008

    Flash Rendering (ASP.NET Enterprise Edition only) - Looking for Flash Charts to complement your current or new web projects? Version 4.0 now fully supports Flash, opening up a whole new dimension to ...

    ViewPager 放大缩小左右移动

    * Sentinel value for no current active pointer. Used by * {@link #mActivePointerId}. */ private static final int INVALID_POINTER = -1; /** * Determines speed during touch scrolling */ ...

Global site tag (gtag.js) - Google Analytics