Jtable编辑单元格的外观 [英] Jtable Look and feel of editing cell

查看:139
本文介绍了Jtable编辑单元格的外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆