public interface TableCellRenderer
JTable
细胞渲染所需的方法。
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
的TableCellRenderer
还负责绘制细胞表示表的电流和下降位置如果有。如果这个渲染器渲染DND关心的放置位置,要查询的表中直接看到如果给定的行和列表示拖放的位置:
jtable.droplocation droplocation =表。getdroplocation();如果(droplocation!= null&!droplocation。isinsertrow()&!droplocation。isinsertcolumn()与droplocation getrow() = =行。与droplocation。getcolumn() = =列){这个单元格表示当前的拖放位置使它特别,也许有一个不同的颜色}
在打印操作过程中,该方法将被称为isSelected
和false
hasFocus
值防止选择和集中出现在打印输出。做其他定制的基于表是否正在印刷,从JComponent.isPaintingForPrint()
检查返回值。
table
-
JTable
,要求渲染绘制;可以
null
value
-细胞呈现价值。它是由特定的渲染和绘制的价值解读。例如,如果
value
是字符串“true”,它可以呈现为一个字符串,也可以呈现为一个复选框被选中。
null
是一个有效值
isSelected
-如果细胞是被渲染的选择突出;否则为false
hasFocus
-如果属实,使细胞适当。例如,在单元格上放置一个特殊的边框,如果单元格可以编辑,用以显示编辑的颜色
row
-细胞的行的索引绘制。当画头,
row
的值是1
column
-细胞被列索引绘制
JComponent.isPaintingForPrint()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.