国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

關于Editor和Renderer的一點認識

2019-11-18 11:32:24
字體:
來源:轉載
供稿:網友

在Sun的官方網站上對Editor和Renderer的解釋是如下:
Renderer:
Instead, a single cell renderer is generally used to draw all of the cells that contain the same type of data. You can think of the renderer as a configurable ink stamp that the table uses to stamp apPRopriately formatted data onto each cell. When the user starts to edit a cell's data, a cell editor takes over the cell, controlling the cell's editing behavior.
個人理解就是對于不同的數據顯示不同的格式,相當于在MVC中根據不同的Model選擇不同的View,Renderer就是給你這個選擇的權利。默認的幾種數據的顯示方式如下:

  • Boolean — rendered with a check box.
  • Number — rendered by a right-aligned label.
  • Double, Float — same as Number, but the object-to-text translation is performed by a NumberFormat關于Editor和Renderer的一點熟悉 instance (using the default number format for the current locale).
  • Date — rendered by a label, with the object-to-text translation performed by a DateFormat關于Editor和Renderer的一點熟悉 instance (using a short style for the date and time).
  • ImageIcon, Icon — rendered by a centered label.
  • Object — rendered by a label that displays the object's string value.
  • 假如你有非凡的數據,想有非凡的顯示方式,可以自己設定Cell的Renderer如下:
    TableCellRenderer weirdRenderer = new WeirdRenderer();
    table = new JTable(...) {
        public TableCellRenderer getCellRenderer(int row, int column) {
            if ((row == 0) && (column == 0)) {
                return weirdRenderer;
            }
            // else...
            return super.getCellRenderer(row, column);
        }
    };
    Editor是用于編輯數據,但是Renderer是用于顯示數據。
    關于Editor,和Renderer遵守相同的法則



    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 清水河县| 藁城市| 松潘县| 海安县| 克拉玛依市| 视频| 青海省| 桐城市| 洛阳市| 容城县| 闵行区| 淄博市| 绍兴市| 伊春市| 商都县| 阳东县| 咸宁市| 铜山县| 泾川县| 乌海市| 罗平县| 梓潼县| 丹东市| 普定县| 九龙县| 嵩明县| 苗栗县| 二手房| 丰原市| 卢湾区| 娄烦县| 多伦县| 靖州| 体育| 呈贡县| 肃南| 花垣县| 巴彦县| 临漳县| 济宁市| 宕昌县|