所以我有自定义的CellEditors和CellRenderers,虽然我正在做
component.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());
component.setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
component.setOpaque(true);在我的getTableCellRendererCompoent中,颜色只在其他行上匹配,因为大多数的hte外观和感觉我似乎试图替换它们。我如何能够以一种与表的其他部分相匹配的方式来提取颜色值?我也非常希望能够制作漂亮的边框,以匹配DefaultTableCellRenderer的渲染器。
我已经尝试过剖析DefaultTableCellRenderer,但是我在寻找这个UI对象时却迷失了方向。我只需要从UIManager中提取正确的属性吗?在正确的方向上领先将是非常感谢的。
谢谢大家这个网站太棒了。约书亚
发布于 2009-08-14 04:11:48
是的,你应该使用摇摆调色板的颜色。例如:
final Color tableBackground = javax.swing.UIManager.getDefaults().getColor("Table.background");以下是表的颜色键值:
或者,您也可以使用系统颜色。例如:
正常背景:
SystemColor.window精选背景:SystemColor.textHighlight普通前景:SystemColor.text选择前台:SystemColor.textText
https://stackoverflow.com/questions/862677
复制相似问题