我有一个 JTable 5x5,我想编写一个过程 setColorTable(JTable table, int Row, int Col),当调用过程 setColorTable 时,它将设置表中行和列的背景颜色。每个人都可以帮助我。
非常感谢。
最佳答案
您必须创建一个自定义 TableCellRenderer 来扩展 Swing 组件(如果您只想更改颜色,JLabel 可能会满足您的需求),并实现 TableCellRenderer 接口(interface)。
关于java - 如何改变JTable中行的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12930858/