Jtable编辑单元格的外观 [英] Jtable Look and feel of editing cell
问题描述
JTable
, DefaultTableModel
。
有桌子的 setforeground
, setbackground
和 setselectioncolor
方法。此外,当您编辑单元格时,您有 table.setDefaultEditor(Object.class,new DefaultCellEditor(field))
方法来更改编辑单元格的字体颜色。
现在如何更改编辑单元格的边框颜色。
谢谢你。
There is a JTable
with DefaultTableModel
.
There is table's setforeground
, setbackground
and setselectioncolor
methods. Also when you are editing the cell you have table.setDefaultEditor(Object.class, new DefaultCellEditor(field))
method to change the editing cell's font color.
Now how to change the border color of the editing cell.
Thankyou.`
推荐答案
你可以在 UIManager.put()
影响相应的边框
:
- Table.focusCellHighlightBorder
- Table.scrollPaneBorder
- TableHeader.cellBorder
例如:
UIManager.put("Table.focusCellHighlightBorder",
new BorderUIResource(BorderFactory.createLineBorder(Color.red)));
您还可以更改自定义渲染器/编辑器中的颜色; PositiveIntegerCellEditor
就是一个例子。另请参见 Concepts:Editors and Renderers 。
You can also change the color in your custom renderer/editor; PositiveIntegerCellEditor
is an example. See also Concepts: Editors and Renderers.
这篇关于Jtable编辑单元格的外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!