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

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

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

    Flyingis

    Talking and thinking freely !
    Flying in the world of GIS !
    隨筆 - 156, 文章 - 16, 評論 - 589, 引用 - 0
    數據加載中……

    AE92 SDK for Java 窗體簡例

    ??? 作者:Flyingis

    ??? ArcEngine開發文檔中提供了另外一個開發簡例HelloGlobe,它是基于JFrame窗體的一個簡單應用,從窗體設計代碼中我們可以看到,ArcEngine已經以JavaBean的形式封裝了一些常用的窗體控件,可以直接的應用到窗體設計的開發中,并且支持跨平臺,給開發者提供了另一種選擇。

    ??? 引用的包:

    import?java.awt.BorderLayout;
    import?java.awt.event.WindowAdapter;
    import?java.awt.event.WindowEvent;
    import?java.io.IOException;
    import?javax.swing.JFrame;

    import?com.esri.arcgis.beans.TOC.TOCBean;
    import?com.esri.arcgis.beans.globe.GlobeBean;
    import?com.esri.arcgis.beans.toolbar.ToolbarBean;
    import?com.esri.arcgis.controls.ControlsGlobeFullExtentCommand;
    import?com.esri.arcgis.controls.ControlsGlobeNavigateTool;
    import?com.esri.arcgis.controls.ControlsGlobeOpenDocCommand;
    import?com.esri.arcgis.system.AoInitialize;
    import?com.esri.arcgis.system.EngineInitializer;
    import?com.esri.arcgis.system.esriLicenseExtensionCode;
    import?com.esri.arcgis.system.esriLicenseProductCode;

    ??? 關于AWT和Swing的使用可以參考相關的書籍,從引用的包中,可以看到TOC、toolbar、globe顯示窗都已經封裝到JavaBean中,可以直接調用,為開發者省了不少事,也幫助開發人員可以像在Visual Studio下設計UI一樣來設計Java的窗體。

    ??? 看看它的窗體設計代碼:

    //
    //?Create?and?display?the?frame
    //
    private?void?display()?throws?IOException?{
    ??setSize(
    500,?400);
    ??
    //
    ??
    //?Create?the?globe,?toolbar,?and?table?of?contents?beans.
    ??
    //
    ??GlobeBean?globeBean?=?new?GlobeBean();
    ??ToolbarBean?toolbarBean?
    =?new?ToolbarBean();
    ??TOCBean?tocBean?
    =?new?TOCBean();
    ??
    //
    ??
    //?Add?beans?to?the?content?pane.
    ??
    //
    ??getContentPane().add(toolbarBean,?BorderLayout.NORTH);
    ??getContentPane().add(globeBean,?BorderLayout.CENTER);
    ??getContentPane().add(tocBean,?BorderLayout.WEST);
    ??
    //
    ??
    //?Add?commands?and?tool?to?the?toolbar.
    ??
    //
    ??toolbarBean.addItem(new?ControlsGlobeOpenDocCommand(),?0,?-1,?false,?0,?1);
    ??toolbarBean.addItem(
    new?ControlsGlobeNavigateTool(),?0,?-1,?false,?0,?1);
    ??toolbarBean.addItem(
    new?ControlsGlobeFullExtentCommand(),?0,?-1,?false,?0,?1);
    ??
    //
    ??
    //?Buddy?up?the?globe?with?the?toolbar?and?table?of?contents.
    ??
    //
    ??toolbarBean.setBuddyControl(globeBean);
    ??tocBean.setBuddyControl(globeBean);
    ??
    //
    ??
    //?Shutdown?ArcObjects?when?the?window?closes.
    ??
    //
    ??addWindowListener(new?WindowAdapter()?{
    ????
    public?void?windowClosing(WindowEvent?e)?{
    ??????
    try?{
    ????????
    new?AoInitialize().shutdown();
    ????????System.exit(
    0);
    ??????}

    ??????
    catch?(IOException?ex)?{
    ????????System.out.println(ex.getMessage());
    ????????System.exit(
    1);
    ??????}

    ????}

    ??}
    );
    ??setVisible(
    true);
    }

    ??? 純粹的Java窗體設計風格,簡單易用。再看看main方法中的內容,和前面一篇《AE92 SDK for Java 最小示例學習》稍有區別。

    ??? main方法:

    public?static?void?main(String?args[])?{
    ??
    try?{
    ????EngineInitializer.initializeVisualBeans();????????????
    ????AoInitialize?aoInitializer?
    =?new?AoInitialize();
    ????aoInitializer.initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
    ????aoInitializer.checkOutExtension(esriLicenseExtensionCode.esriLicenseExtensionCode3DAnalyst);
    ????HelloGlobe?thisApp?
    =?new?HelloGlobe();
    ????thisApp.setTitle(
    "Hello,?Globe!");
    ????thisApp.display();
    ??}

    ??
    catch?(IOException?ex)?{
    ????System.out.println(ex.getMessage());
    ??}

    }

    ??? 由于應用程序使用了窗體,因此在原始AO組建和Java Class建立關聯時,需要initializeVisualBeans方法來初始化,initializeVisualBeans和initializeEngine兩者選其一,使用可視化Beans選擇前者,否則選擇后者。這里aoInitializer對象除了指定相應的license授權,還檢查相應的應用擴展。

    ??? AE92 SDK for Java 已經集成到Eclipse3.2中,通過ArcEngine模板建立一個HelloGlobe工程,看看運行顯示的結果:

    HelloGlobe.gif

    ??? 基于這個模板框架,可以方便我們深入擴展Globe二次開發的功能。

    posted on 2007-03-09 12:41 Flyingis 閱讀(4950) 評論(2)  編輯  收藏 所屬分類: ArcEngine

    評論

    # re: AE92 SDK for Java 窗體簡例[未登錄]  回復  更多評論   

    怎么設置toolbar的tip,我添加上toolbar后里面的按鈕全是英文的,怎么修改成中文?
    2008-01-10 09:20 | 王飛

    # re: AE92 SDK for Java 窗體簡例  回復  更多評論   

    ArcGIS Engine JAVA qq群: 24450639
    2009-02-22 17:49 | leagion
    主站蜘蛛池模板: 色猫咪免费人成网站在线观看| 男男gay做爽爽的视频免费| 水蜜桃视频在线观看免费播放高清 | 2020久久精品国产免费| 久久亚洲春色中文字幕久久久 | baoyu116.永久免费视频| 亚洲人成网站在线观看播放| 日韩精品无码免费专区网站| 亚洲AV日韩AV鸥美在线观看| 精品无码AV无码免费专区| 亚洲男女一区二区三区| 免费国产黄线在线观看| 亚洲av无码无线在线观看| 亚洲&#228;v永久无码精品天堂久久 | 亚洲成a人片77777老司机| 99精品视频在线视频免费观看| 亚洲精品国产电影午夜| 啦啦啦手机完整免费高清观看| 亚洲欧美日韩中文无线码| 亚洲A∨午夜成人片精品网站| 中文字幕av无码不卡免费| 亚洲四虎永久在线播放| 拍拍拍又黄又爽无挡视频免费| 色天使亚洲综合一区二区| 国产午夜亚洲精品理论片不卡| 久久免费区一区二区三波多野| 亚洲美女一区二区三区| 成人免费男女视频网站慢动作| 在线看亚洲十八禁网站| 国产av无码专区亚洲av桃花庵| 午夜国产精品免费观看| 美女黄频免费网站| 亚洲免费在线播放| 免费观看午夜在线欧差毛片| 99re6在线视频精品免费| 亚洲一区二区三区国产精品无码 | 亚洲gv猛男gv无码男同短文| 一二三四在线观看免费高清中文在线观看| 国产青草亚洲香蕉精品久久| 久久亚洲精品国产精品黑人| 成人免费视频国产|