zoukankan      html  css  js  c++  java
  • 第三章 第六节 SWT类的常量与函数

    第六节 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

    返回目录

  • 相关阅读:
    微博个人中心效果
    微博弹性按钮
    ios9 3dtouch 博客
    去掉导航栏阴影
    模态全屏模式,实现半透明效果
    剪切图片
    修改push动画的方向
    数据库链接池终于搞对了,直接从100ms到3ms
    如何在Java代码中去掉烦人的“!=null”
    面试官:请讲下接口具体怎么优化!
  • 原文地址:https://www.cnblogs.com/ols/p/2173312.html
Copyright © 2011-2022 走看看