简体   繁体   English

Jtable编辑单元格的外观

[英]Jtable Look and feel of editing cell

There is a JTable with DefaultTableModel . 有一个带有DefaultTableModelJTable There is table's setforeground , setbackground and setselectioncolor methods. 有表的setforegroundsetbackgroundsetselectioncolor方法。 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. 同样,在编辑单元格时,您具有table.setDefaultEditor(Object.class, new DefaultCellEditor(field))方法来更改编辑单元格的字体颜色。 Now how to change the border color of the editing cell. 现在如何更改编辑单元格的边框颜色。 Thankyou.` Thankyou.`

You can use any of the following keys in UIManager.put() to affect the corresponding Border : 您可以在UIManager.put()使用以下任意键来影响相应的Border

  • Table.focusCellHighlightBorder Table.focusCellHighlightBorder
  • Table.scrollPaneBorder Table.scrollPaneBorder
  • TableHeader.cellBorder TableHeader.cellBorder

For example: 例如:

UIManager.put("Table.focusCellHighlightBorder",
    new BorderUIResource(BorderFactory.createLineBorder(Color.red)));

You can also change the color in your custom renderer/editor; 您还可以在自定义渲染器/编辑器中更改颜色。 PositiveIntegerCellEditor is an example. PositiveIntegerCellEditor是一个示例。 See also Concepts: Editors and Renderers . 另请参见概念:编辑器和渲染器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM