惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Jina AI
Jina AI
C
Check Point Blog
V
V2EX
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
A
About on SuperTechFans
D
DataBreaches.Net
腾讯CDC
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
博客园_首页
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - ols

grails导入excel grails的插件 grails环境搭建 短租app简析 在.net中用NAudio控件播放MP3 不小心发现中粮网站的一个bug 第十三章 第六节 本章小结 第十三章 第五节 关于WindowManager的一些话 第十三章 第四节 ApplicationWindow类 第十三章 第三节 SWT和JFace的关系 第十三章 第二节 问候JFace的世界 第十三章 第一节 概述 第四章 第五节 使用GridLayout 第四章 第四节 使用RowLayout 第四章 第三节 使用FillLayout 第四章 第二节 布局 第四章 第一节 概述 第三章 第七节 本章小结 第三章 第五节 剖析Shell对象
第三章 第六节 SWT类的常量与函数
ols · 2011-09-10 · via 博客园 - ols

第六节 SWT类的常量与函数

返回目录

SWT类有一堆类级别(class-level)的常量和方法用来简化SWT编程。

没有什么事情阻止您创建一个SWT对象,因为创建一个不会带来任何坏处。SWT类继承于java.lang.Object,它没有定义构造函数,所以默认的构造函数会被调用。然而,一个SWT对象除了继承于java.lang.Object的状态,没有任何状态(state),本质上这些状态也是没什么用的。

SWT类提供了一些有用的方法,像前面提到的,都是静态的(static)。大多数程序不必用到这些方法;它们在表3-6中列出。

3-6: SWT 的方法

方法

说明

static void error(int code)

Throws an exception based on code. It's the same as calling static void error(int code, (Throwable) null).

static void error(int code, Throwable throwable)

Throws an exception based on code. throwable should either be null or the Throwable that caused SWT to throw an exception. code is one of the error constants defined in SWT.

static String getMessage (String key)

Gets the appropriate National Language Support (NLS) message as a String for key. See java.util.ResourceBundle for more information on NLS. The resource bundle is found in org.eclipse.swt.internal.SWTMessages .properties; see Table 3-7 for the supported keys and corresponding messages.

static String getPlatform()

Gets the SWT platform name (for example, "win32," "gtk," "carbon").

static int getVersion()

Gets the SWT library version number.

3-7: SWT消息的键(Key)和值(value)

SWT_Yes

Yes

SWT_No

No

SWT_OK

OK

SWT_Cancel

Cancel

SWT_Abort

Abort

SWT_Retry

Retry

SWT_Ignore

Ignore

SWT_Sample

Sample

SWT_A_Sample_Text

A Sample Text

SWT_Selection

Selection

SWT_Current_Selection

Current Selection

SWT_Font

Font

SWT_Color

Color

SWT_Extended_style

Extended style

SWT_Size

Size

SWT_Style

Style

SWT_Save

Save

SWT_Character_set

Character set

SWT_ColorDialog_Title

Colors

SWT_FontDialog_Title

Fonts

SWT_Charset_Western

Western

SWT_Charset_EastEuropean

East European

SWT_Charset_SouthEuropean

South European

SWT_Charset_NorthEuropean

North European

SWT_Charset_Cyrillic

Cyrillic

SWT_Charset_Arabic

Arabic

SWT_Charset_Greek

Greek

SWT_Charset_Hebrew

Hebrew

SWT_Charset_Turkish

Turkish

SWT_Charset_Nordic

Nordic

SWT_Charset_Thai

Thai

SWT_Charset_BalticRim

Baltic Rim

SWT_Charset_Celtic

Celtic

SWT_Charset_Euro

Euro

SWT_Charset_Romanian

Romanian

SWT_Charset_SimplifiedChinese

Simplified Chinese

SWT_Charset_TraditionalChinese

Traditional Chinese

SWT_Charset_Japanese

Japanese

SWT_Charset_Korean

Korean

SWT_Charset_Unicode

Unicode

SWT_Charset_ASCII

ASCII

SWT_InputMethods

Input Methods

Windows XPEclipse 2.1.1中输入这些代码:

System.out.println("Platform: " + SWT.getPlatform());

System.out.println("Version: " + SWT.getVersion());

这些代码会打印:

Platform: win32

Version: 2135

返回目录