<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    The Goal
    Keep walking……
    posts - 23,  comments - 1,  trackbacks - 0
    • Model-based adapters

    與SWT widgets一起工作的JFace類可稱為model-based adapters [或helper classes].這些adapter可以分為4類:
    1.Viewers
    將GUI組件中的信息與外觀分離 [與SWT不同]
    2.Actions and contributions
    簡化了事件的處理,將用戶命令的反應與引發反應的事件分離
    3.Image and font registries
    注冊機制,資源可以被按需分配和釋放

    4.Dialogs and wizards
    信息框、錯誤框、進度框與向導框等

    • SET/JFace應用程序的三段式結構

    package com.swtjface.Ch2;

    import org.eclipse.jface.window.*;

    import org.eclipse.swt.*;

    import org.eclipse.swt.widgets.*;


    public class HelloSWT_JFace extends ApplicationWindow {

    public HelloSWT_JFace() {

    super(null); //1.Window allocation

    }

    protected Control createContents(Composite parent) {

    Text helloText = new Text(parent, SWT.CENTER);

    helloText.setText("Hello SWT and JFace!");

    parent.pack();

    return parent; //2.Window presentation

    /*處理窗口的設計,由于ApplicationWindow的可視部分不能被直接access,此方法連同一個Composite來控制GUI的顯示,此container對象[Composite]是所有被加入應用程序的GUI組件的父件*/

    }

    public static void main(String[] args) {

    HelloSWT_JFace awin = new HelloSWT_JFace();

    awin.setBlockOnOpen(true);

    awin.open();

    Display.getCurrent().dispose();? //3.Window operation

    /*負責GUI的實際運作。在分派好ApplicationWindow的資源之后,main方法使窗口顯示,當setBlockOnOpen()方法以一個true參數被調用的時候,窗口關閉。然后ApplicationWindow的open()方法被調用,根據createContent()方法所返回的Composite來顯示窗口。然后程序通過dispose()方法釋放GUI的Display實例.因為此程序中的所有widget都是display的child,所以一旦釋放Display,所有的widget都被釋放*/

    }

    }

    • SWT與SWT/JFace的區別

    SWT將GUI的外觀和操作都放在它的Shell類里,而SWT/JFace卻將兩者分離開來了,其中外觀由createContents()方法內的Compsite來控制,而操作部分大體上是通過ApplicationWindow類的實例來實現的。

    • ApplicationWindow

    SWT/JFace同樣需要一個單獨的Display實例,但是只要ApplicationWindow通過一個null參數來構建,那么就會創建它自己的Shell。參閱下圖

    ApplicationWindow在Shell的基礎上提供了更多的途徑來設計窗口,其相關方法如下:
    addMenuBar()
    Configures the window with a top-level menu
    addToolBar()
    Adds a toolbar beneath the main menu
    addStatusLine()
    Creates a status area at the bottom of the window
    setStatus(String)
    Displays a message in the status area
    getSeparator()
    Returns the line separating the menu from the window
    setDefaultImage(Image)
    Displays an image when the application has no shell
    setExceptionHandler(IExceptionHandler)
    Configures the application to handle exceptions according to the specified interface

    posted on 2006-03-15 17:07 JOO 閱讀(329) 評論(0)  編輯  收藏 所屬分類: SWT & JFace IN ACTION
    Hit the target!

    <2006年3月>
    2627281234
    567891011
    12131415161718
    19202122232425
    2627282930311
    2345678

    常用鏈接

    留言簿(2)

    隨筆分類(23)

    隨筆檔案(22)

    文章檔案(1)

    相冊

    Neighbor

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 免费a级毛片永久免费| 亚洲熟妇av一区二区三区漫画| 国产亚洲成人久久| 亚洲色无码一区二区三区| 免费人成再在线观看网站| 国产精品福利片免费看| 亚洲天堂免费在线| 久久久久亚洲AV成人片| 97公开免费视频| 免费一区二区视频| 国产成人亚洲毛片| 亚洲午夜无码AV毛片久久| 亚洲国产美女在线观看| A在线观看免费网站大全| 亚洲伊人久久大香线蕉AV| 你懂的免费在线观看| 啦啦啦手机完整免费高清观看| 亚洲精品美女久久久久久久| 免费无码中文字幕A级毛片| 亚洲а∨天堂久久精品| 久久免费国产精品| 久久精品蜜芽亚洲国产AV| 69xx免费观看视频| 久久精品国产精品亚洲精品 | 午夜亚洲WWW湿好爽| 国产高清免费在线| wwwxxx亚洲| 日韩在线播放全免费| 亚洲中文字幕乱码一区| 亚洲成?Ⅴ人在线观看无码| 在线涩涩免费观看国产精品| 亚洲视频免费播放| 无码人妻久久一区二区三区免费 | 日韩免费视频播放| eeuss草民免费| 亚洲电影在线播放| 免费看国产曰批40分钟| 99国产精品免费视频观看| 亚洲欧美日韩综合俺去了| 青青草原亚洲视频| 一级做a爰片久久毛片免费陪 |