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

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

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

    學用Java

    奇新Java控件---Java控件提供商和Java RIA, Web, J2ME解決方案開發商

    介紹JComponentPack產品中的JListView控件


    If you want to implements the Windows explorer like feature in Java swing application, the JListView component meets your requirements exactly.

    The JListView component support the 5 different view modes: small icon, large icon, list, thumbnails, details, all these view mode can change on the fly, the methods “JListView.setViewMode” can change the view mode of JListView component.

    The JListView component have the MVC design concept, a simple TableModel can be provided for it’s data, a simple CellProvider such IconProvider can be provided for it’s icon. Should write a DefaultCellRenderer subclass for its renderer and DefaultCellEditor subclass for it’s editor. The article “Introduce Cell Renderer” introduce why using the DefaultCellRenderer.

    The JListView component use a ListSelectionModel as it’s selection model, you can change the selection model’s mode, it support single selection, single interval selection, multiple interval selection, you can use the following methods to get the selected values:

          JListView.getSelectedValue(); // get the lead selection value
           JListView.getSelectedValues(); // get all selected values

    The JListView component provides several methods for it’s editing:
           JListView.isEditing(); // determines whether the JListView is being edited.
           JListView.cancelEditing(); // cancel current editing
           JListView.stopEditing(); // stop the current editing and apply the editing value
           JListView.startEditingAtIndex(); // start the editing at the specified index
           JListview.getEditingInex(); // get the current editing object’s index

    The com.zfqjava.swing.model and com.zfqjava.swing.cell package have the FileTableModel and FileProvider, it support the directory list and file icon directly, the following code can create a explorer like GUI:

           JListView listView = new JListView();
           listView.setListData(new FileTableModel(new File(System.getProperty("user.home"))));
           listView.setCellRenderer(new FileCellRenderer());
           listView.setCellEditor(new FileCellEditor());

    The JListView component also support row sorting, the TableModel you provided for JListView only need implements the ColumnSorter interface, it can support the row sorting automatically, we want to improve this area after upgrade the JRE version to 1.6.

    The JListView component provides several important client property:

    JListView.rowSelectionAllowed” allow the full row can be selected
    JListView.showVerticalLines” shows the vertical lines in details view mode.
    JListView.showHorizontalLines” shows the horizontal lines in details view mode.
    JListView.backgroundImage” sets the background image for JListView component.

    For details, you can view the JListView JavaDoc API documentation.

    The JListView also support the Drag and Drop, but in JComponentPack 1.1.0 and early version, implements this feature has trick and tips:

           // get JTable and JList
           BasicListViewUI ui = (BasicListViewUI)listView.getUI();
           JTable table = ui.getTable();
           JList list = ui.getList();
           table.setDragEnabled(true);
           list.setDragEnabled(true);
           TransferHandler th = new TransferHandler() {             
                  public int getSourceActions(JComponent c) {
                   return COPY;
            }
                  protected Transferable createTransferable(JComponent c) {
                      // just a test
                      Object o = listView.getSelectedValue();
                      if(o != null) {
                         return new StringSelection(o.toString());
                      }
                      return null;
                  }
               };
           table.setTransferHandler(th);
           list.setTransferHandler(th);

    In the upcoming version JComponentPack 1.2.0, we have improved this area, so in the new version, implements the drag and drop feature is very simple:

           listView.setDragEnabled(true);
    TransferHandler th = new TransferHandler() {
                  public int getSourceActions(JComponent c) {
                   return COPY;
            }

                  protected Transferable createTransferable(JComponent c) {
                      // just a test
                      Object o = listView.getSelectedValue();
                      if(o != null) {
                         return new StringSelection(o.toString());
                      }
                      return null;
                  }
               };
           listView. setTransferHandler(th);


    If you want to implements the Windows explorer like feature in Java swing application, the JListView component meets your requirements exactly.

    The JListView component support the 5 different view modes: small icon, large icon, list, thumbnails, details, all these view mode can change on the fly, the methods “JListView.setViewMode” can change the view mode of JListView component.

    The JListView component have the MVC design concept, a simple TableModel can be provided for it’s data, a simple CellProvider such IconProvider can be provided for it’s icon. Should write a DefaultCellRenderer subclass for its renderer and DefaultCellEditor subclass for it’s editor. The article “Introduce Cell Renderer” introduce why using the DefaultCellRenderer.

    The JListView component use a ListSelectionModel as it’s selection model, you can change the selection model’s mode, it support single selection, single interval selection, multiple interval selection, you can use the following methods to get the selected values:

          JListView.getSelectedValue(); // get the lead selection value
           JListView.getSelectedValues(); // get all selected values

    The JListView component provides several methods for it’s editing:
           JListView.isEditing(); // determines whether the JListView is being edited.
           JListView.cancelEditing(); // cancel current editing
           JListView.stopEditing(); // stop the current editing and apply the editing value
           JListView.startEditingAtIndex(); // start the editing at the specified index
           JListview.getEditingInex(); // get the current editing object’s index

    The com.zfqjava.swing.model and com.zfqjava.swing.cell package have the FileTableModel and FileProvider, it support the directory list and file icon directly, the following code can create a explorer like GUI:

           JListView listView = new JListView();
           listView.setListData(new FileTableModel(new File(System.getProperty("user.home"))));
           listView.setCellRenderer(new FileCellRenderer());
           listView.setCellEditor(new FileCellEditor());

    The JListView component also support row sorting, the TableModel you provided for JListView only need implements the ColumnSorter interface, it can support the row sorting automatically, we want to improve this area after upgrade the JRE version to 1.6.

    The JListView component provides several important client property:

    JListView.rowSelectionAllowed” allow the full row can be selected
    JListView.showVerticalLines” shows the vertical lines in details view mode.
    JListView.showHorizontalLines” shows the horizontal lines in details view mode.
    JListView.backgroundImage” sets the background image for JListView component.

    For details, you can view the JListView JavaDoc API documentation.

    The JListView also support the Drag and Drop, but in JComponentPack 1.1.0 and early version, implements this feature has trick and tips:

           // get JTable and JList
           BasicListViewUI ui = (BasicListViewUI)listView.getUI();
           JTable table = ui.getTable();
           JList list = ui.getList();
           table.setDragEnabled(true);
           list.setDragEnabled(true);
           TransferHandler th = new TransferHandler() {             
                  public int getSourceActions(JComponent c) {
                   return COPY;
            }
                  protected Transferable createTransferable(JComponent c) {
                      // just a test
                      Object o = listView.getSelectedValue();
                      if(o != null) {
                         return new StringSelection(o.toString());
                      }
                      return null;
                  }
               };
           table.setTransferHandler(th);
           list.setTransferHandler(th);

    In the upcoming version JComponentPack 1.2.0, we have improved this area, so in the new version, implements the drag and drop feature is very simple:

           listView.setDragEnabled(true);
    TransferHandler th = new TransferHandler() {
                  public int getSourceActions(JComponent c) {
                   return COPY;
            }

                  protected Transferable createTransferable(JComponent c) {
                      // just a test
                      Object o = listView.getSelectedValue();
                      if(o != null) {
                         return new StringSelection(o.toString());
                      }
                      return null;
                  }
               };
           listView. setTransferHandler(th);



    posted on 2009-02-25 10:56 fralepg 閱讀(522) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    <2009年2月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    1234567

    導航

    統計

    公告

    JComponentPack 3.0正式發布 功能介紹

    JComponentPack 是一個基于Java SwingGUI類庫,一系列可視化的JavaBeans集合,它基于SwingMVC架構,是100%的純Java類庫,它包括20多個Swing 所沒有的控件

    試用版下載(點擊下載

    常用鏈接

    留言簿(1)

    隨筆檔案

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 免费a级毛片无码a∨性按摩| 中文字幕亚洲情99在线| 亚洲中久无码不卡永久在线观看| 在线观看免费大黄网站| 免费国产成人午夜电影| 亚洲AV女人18毛片水真多| 伊人久久大香线蕉免费视频| 无码少妇精品一区二区免费动态| 18禁止看的免费污网站| 国产资源免费观看| 久久精品国产亚洲沈樵| 亚洲一区二区三区免费在线观看| 亚洲色偷偷综合亚洲AV伊人蜜桃 | 精品亚洲成AV人在线观看| 亚洲伦另类中文字幕| 国产亚洲精品AAAA片APP| 中文字幕免费视频| 青青青国产色视频在线观看国产亚洲欧洲国产综合 | 国产高清免费的视频| 黄网站在线播放视频免费观看| 无码精品一区二区三区免费视频| 亚洲国产第一页www| 国产91色综合久久免费分享| 国产成人亚洲精品青草天美| 国产成人精品免费久久久久| 亚洲精品国产V片在线观看 | 无码毛片一区二区三区视频免费播放 | 久久亚洲AV午夜福利精品一区| 激情婷婷成人亚洲综合| 久久亚洲色一区二区三区| 国产亚洲美女精品久久久久| 在线观看特色大片免费视频| 亚洲国产精品va在线播放 | 国产一区二区三区免费在线观看 | 亚洲成a人片在线观| 久久免费精彩视频| 亚洲中文无码永久免费| 亚洲综合另类小说色区| 日韩在线观看免费完整版视频| 亚洲AV无码国产精品麻豆天美| 在线观看免费视频网站色|