<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 閱讀(325) 評論(0)  編輯  收藏 所屬分類: SWT & JFace IN ACTION
    Hit the target!

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

    常用鏈接

    留言簿(2)

    隨筆分類(23)

    隨筆檔案(22)

    文章檔案(1)

    相冊

    Neighbor

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲国产日韩精品| 亚洲人6666成人观看| 美女露100%胸无遮挡免费观看| 黄网站色在线视频免费观看| 亚洲国产精品热久久| 99精品视频在线观看免费专区 | 一出一进一爽一粗一大视频免费的| 日韩成人免费aa在线看| 久久精品国产亚洲av天美18| 免费少妇a级毛片| 成在线人免费无码高潮喷水| 国产国拍亚洲精品mv在线观看| 性xxxxx大片免费视频| 亚洲高清视频在线播放| 黄色片在线免费观看| 亚洲国产精品自在自线观看| 亚洲成a人片在线观看久| 中文字幕高清免费不卡视频| 亚洲AV美女一区二区三区| 亚洲高清免费在线观看| 亚洲色精品三区二区一区| 免费欧洲毛片A级视频无风险| 成年网在线观看免费观看网址| 在线观看亚洲精品福利片| 99热免费在线观看| 亚洲欧美日韩综合久久久久| 亚洲成人影院在线观看| 久久免费区一区二区三波多野| 亚洲一卡二卡三卡四卡无卡麻豆| 国产免费人成视频在线观看| 久久九九免费高清视频| 亚洲国产精品人久久电影| 免费一级肉体全黄毛片| 亚洲免费在线视频| 亚洲AV综合色区无码一二三区| 国产成人麻豆亚洲综合无码精品| 24小时在线免费视频| 黄页网址在线免费观看| 亚洲综合成人网在线观看| 国产99视频精品免费视频7| 日本在线看片免费人成视频1000|