隨筆-50  評論-55  文章-8  trackbacks-0
          ?在使用java默認的lokandfeel的 時候,要想讓JTree不同的行顯示行高,只需要cellRenderer的組件設置大小就可以了,而換作windowlookandfeel的時候,不僅要設置組件大小,對樹還要設置 setRowHeight(0);
          請看如下解釋:
          The tree component's row height property controls the height of every displayed node. If the row height is greater than 0, all rows will be given the specified height. However, if the rows can be of differing heights, it is necessary to set the row height to 0. With a 0 row height, all heights of all rows are computed individually.
              // Create tree
              JTree tree = new JTree();
              
              // All rows will be given 15 pixels of height
              tree.setRowHeight(15);
              
              // Have the row height for each row computed individually
              tree.setRowHeight(0);
              
              // If the row height is 0 and the height of a row has dynamically changed, it is necessary
              // to flush the internal cache of row heights. The following calls flush the internal cache.
              if (tree.getRowHeight() <= 0) {
                  // Temporary change to non-zero height
                  tree.setRowHeight(1);
              }
              tree.setRowHeight(0);
          以上解釋來自:http://www.javaref.cn/egs/javax.swing.tree/RowHeight.html

          ?Related Examples
          posted on 2007-11-26 10:28 蔣家狂潮 閱讀(554) 評論(0)  編輯  收藏 所屬分類: Swing

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


          網站導航:
           

          成王敗寇
          QQ:29357120
          MSN:dh.jiang@live.cn
          E-mail:simon1006@163.com

          <2007年11月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          留言簿(1)

          隨筆分類(43)

          隨筆檔案(35)

          相冊

          積分與排名

          • 積分 - 58428
          • 排名 - 894

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 龙泉市| 普安县| 武鸣县| 赤峰市| 仲巴县| 南昌市| 天门市| 托克逊县| 成武县| 定西市| 广宗县| 和林格尔县| 民丰县| 南皮县| 阿尔山市| 巴彦县| 闻喜县| 五常市| 积石山| 普兰县| 方城县| 左权县| 察雅县| 婺源县| 建昌县| 嘉黎县| 郎溪县| 西藏| 濉溪县| 尼勒克县| 蒲江县| 肇东市| 江口县| 静乐县| 浏阳市| 华亭县| 安新县| 都昌县| 乳山市| 宁乡县| 桂阳县|