何以解憂?唯有Java

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

          JXTaskPane 示例

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

          下面兩張截圖反應了JXTaskPane的動畫效果。可以自由的卷起和展開。

            

          JXTaskPane的的使用步驟:

          1、新建一個 JXTaskPaneContainer

          2、新建{i}個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);


          默認JXTaskPane 的動畫功能是起用的,你也可以關閉 :

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




          評論

          # re: JXTaskPane 示例  回復  更多評論   

          2011-09-29 09:14 by tb
          界面做得不錯啊
          主站蜘蛛池模板: 徐汇区| 察隅县| 五莲县| 宁强县| 夏邑县| 泸溪县| 同仁县| 余江县| 呼伦贝尔市| 青川县| 赤城县| 宿州市| 巩留县| 永清县| 曲阳县| 运城市| 朔州市| 林西县| 嫩江县| 循化| 定南县| 阿拉善左旗| 烟台市| 邹城市| 曲阜市| 肥乡县| 西和县| 冷水江市| 襄垣县| 平乐县| 闵行区| 四川省| 当涂县| 罗平县| 交口县| 项城市| 独山县| 布尔津县| 平定县| 金阳县| 称多县|