何以解憂?唯有Java

          其實(shí)程序員也懂得浪漫!
          posts - 90, comments - 637, trackbacks - 0, articles - 2
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          JXTaskPane 示例

          Posted on 2009-11-27 17:47 guanminglin@gmail.com 閱讀(27462) 評(píng)論(1)  編輯  收藏 所屬分類: JavaSENetBeans
          JXTaskPane 類似XP 左邊的導(dǎo)航欄,在開發(fā)Swing應(yīng)用的時(shí)候很好用的。

          下面兩張截圖反應(yīng)了JXTaskPane的動(dòng)畫效果。可以自由的卷起和展開。

            

          JXTaskPane的的使用步驟:

          1、新建一個(gè) JXTaskPaneContainer

          2、新建{i}個(gè)JXTaskPane   (i>=1)

          3、依次將 新建的JXTaskPane 添加到 JXTaskPaneContainer 中去。

          4、最后將 JXTaskPaneContainer 添加到JFrame 中。

          附上 SwingX doc中的示例代碼


           JXFrame frame = new JXFrame();
           
           
          // a container to put all JXTaskPane together
           JXTaskPaneContainer taskPaneContainer = new JXTaskPaneContainer();
           
           
          // create a first taskPane with common actions
           JXTaskPane actionPane = new JXTaskPane();
           actionPane.setTitle(
          "Files and Folders");
           actionPane.setSpecial(
          true);
           
           
          // actions can be added, a hyperlink will be created
           Action renameSelectedFile = createRenameFileAction();
           actionPane.add(renameSelectedFile);
           actionPane.add(createDeleteFileAction());
           
           
          // add this taskPane to the taskPaneContainer
           taskPaneContainer.add(actionPane);
           
           
          // create another taskPane, it will show details of the selected file
           JXTaskPane details = new JXTaskPane();
           details.setTitle(
          "Details");
            
           
          // add standard components to the details taskPane
           JLabel searchLabel = new JLabel("Search:");
           JTextField searchField 
          = new JTextField("");
           details.add(searchLabel);
           details.add(searchField);
           
           taskPaneContainer.add(details);
           
           
          // put the action list on the left 
           frame.add(taskPaneContainer, BorderLayout.EAST);
           
           
          // and a file browser in the middle
           frame.add(fileBrowser, BorderLayout.CENTER);
           
           frame.pack();
           frame.setVisible(
          true);


          默認(rèn)JXTaskPane 的動(dòng)畫功能是起用的,你也可以關(guān)閉 :

          只要 myJXTaskPane.setAnimated(false);  就可以了。




          評(píng)論

          # re: JXTaskPane 示例  回復(fù)  更多評(píng)論   

          2011-09-29 09:14 by tb
          界面做得不錯(cuò)啊
          主站蜘蛛池模板: 凤阳县| 广水市| 大新县| 青铜峡市| 德格县| 灵山县| 西乌珠穆沁旗| 疏附县| 临桂县| 涿鹿县| 宁德市| 隆回县| 贡觉县| 徐水县| 将乐县| 拉萨市| 宕昌县| 甘谷县| 子洲县| 阳东县| 齐河县| 哈尔滨市| 巫溪县| 荔浦县| 秦皇岛市| 定兴县| 桂阳县| 金湖县| 富民县| 佳木斯市| 八宿县| 彩票| 遂川县| 长顺县| 海淀区| 岳西县| 恩平市| 阿坝县| 防城港市| 黔西| 武邑县|