實現JComboBox 下拉菜單鼠標懸停提示功能

           1 
           2 JComboBox comboBoxRow= new JComboBox();
           3 
           4 comboBoxRow.setRenderer(new ListCellRenderer() {  
           5             private ListCellRenderer renderer = comboBoxRow.getRenderer();  
           6             public Component getListCellRendererComponent(JList list,  
           7             Object value, int index, boolean isSelected, boolean cellHasFocus) {  
           8                 Component component = renderer.getListCellRendererComponent(  
           9                         list, value, index, isSelected, cellHasFocus);  
          10                 if (component instanceof JLabel) {  
          11                     JLabel label = (JLabel) component;  
          12                     label.setToolTipText(label.getText());  
          13                 }  
          14                 return component;  
          15             }  
          16         });


          眼鏡蛇

          posted on 2014-07-30 16:47 眼鏡蛇 閱讀(463) 評論(0)  編輯  收藏 所屬分類: AWT/SWING/SWT

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統計

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 堆龙德庆县| 武乡县| 交口县| 达州市| 望城县| 二连浩特市| 屏山县| 石楼县| 平泉县| 建宁县| 长泰县| 来凤县| 扬州市| 隆尧县| 兴城市| 卢湾区| 中阳县| 土默特右旗| 尚义县| 屯门区| 柘城县| 扬中市| 镇远县| 崇义县| 台南市| 瓮安县| 静安区| 百色市| 明星| 青岛市| 遂宁市| 阳曲县| 吉安县| 宜城市| 六枝特区| 伊吾县| 闽侯县| 黄冈市| 凭祥市| 冷水江市| 兴业县|