简体   繁体   English

如何在jTable中更改列的颜色?

[英]How to change the color of a column in jTable?

I have kept some colors for animals in Database. 我在数据库中为动物保留了一些颜色。 Say there are four animals and have assigned four colors for each in Database. 假设有四种动物,并且在数据库中为每种动物分配了四种颜色。 In jTable when i select an animal of my choice ,i need to the color also to be applied. 在jTable中,当我选择自己选择的动物时,我还需要应用颜色。

Ex-If i click Elephant ,the assigned color should be my background. 例如,如果我单击“大象”,则分配的颜色应该是我的背景。

Cell formatting is the responsibility of the TableCellRenderer 单元格格式由TableCellRenderer负责

Take a look at Using Custom Renderers for more details 有关更多详细信息,请参阅使用自定义渲染器

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

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