<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

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 99久久国产亚洲综合精品| 久久精品国产亚洲AV果冻传媒| 久久夜色精品国产噜噜亚洲a| 2015日韩永久免费视频播放| 亚洲AV无码一区二区二三区入口| eeuss免费影院| 中国亚洲女人69内射少妇| 国产一区二区三区免费观在线| 亚洲人JIZZ日本人| 日本免费高清视频| 亚洲精品国产成人中文| 成人黄色免费网址| 亚洲色偷精品一区二区三区| 永久免费看bbb| 羞羞视频免费网站入口| 亚洲综合色区在线观看| 国产免费一区二区视频| 亚洲精品在线免费看| 成人免费无码大片a毛片| 苍井空亚洲精品AA片在线播放| 亚洲AV中文无码乱人伦| 国产乱子伦精品免费视频| 亚洲成a人片77777kkkk| 国产h肉在线视频免费观看| 亚洲最大天堂无码精品区| 免费在线观看你懂的| 无码人妻精品中文字幕免费| 亚洲国产午夜精品理论片| 日本高清免费不卡在线| 中国精品一级毛片免费播放| 精品亚洲成AV人在线观看| 在线免费一区二区| 国产免费人成视频在线播放播| 久久精品国产亚洲av高清漫画| 性感美女视频在线观看免费精品| 深夜福利在线视频免费| 亚洲尹人九九大色香蕉网站| 国产三级免费观看| 久久综合九色综合97免费下载| 亚洲最大的成人网| 亚洲春色在线视频|