JTable外观 [英] JTable Look and Feel

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

问题描述

在通过双击进行编辑时如何更改JTable字体的颜色. 有JTable的背景色,JTable的前景色和选择色.如何更改JTables单元格编辑文本的颜色.

How to change the JTable's font's colors when editing by double click. There is JTable's background color, JTable's foreground color and selection colors. How to change the colors of JTables cell editing text.

谢谢.

推荐答案

假设您要在编辑该单元格的同时更改单元格的颜色 :配置cellEditor使用的textField:

Assuming you mean to change the color of the cell while editing that cell: configure the textField used by the cellEditor:

JTextField field = new JTextField();
field.setForeground(Color.RED);
table.setDefaultEditor(Object.class, new DefaultCellEditor(field));

这篇关于JTable外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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