Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何防止选中单元格时突出显示?_Java_Swing_Jtable_Tablemodel - Fatal编程技术网

Java 如何防止选中单元格时突出显示?

Java 如何防止选中单元格时突出显示?,java,swing,jtable,tablemodel,Java,Swing,Jtable,Tablemodel,我将AbstractTableModel的第一列指定为具有复选框。但是当我点击复选框时,整行都被选中了。我不介意,但我想知道是否有办法防止第一列突出显示?检查传递给GetTableCellRenderComponent()方法的isSelected参数,并相应地设置选择颜色。要影响所有一致的渲染器,可以使用相关的UIManager键、Table.background和Table.selectionBackground使选择颜色等于背景颜色 UIManager.put("Table.selecti

我将AbstractTableModel的第一列指定为具有复选框。但是当我点击复选框时,整行都被选中了。我不介意,但我想知道是否有办法防止第一列突出显示?

检查传递给
GetTableCellRenderComponent()
方法的
isSelected
参数,并相应地设置选择颜色。要影响所有一致的渲染器,可以使用相关的
UIManager
键、
Table.background
Table.selectionBackground
使选择颜色等于背景颜色

UIManager.put("Table.selectionBackground", UIManager.get("Table.background"));
在acustom渲染器中,可以指定相同的颜色,而不考虑
isSelected

检查传递给
GetTableCellRenderComponent()
方法的
isSelected
参数,并相应地设置选择颜色。要影响所有一致的渲染器,可以使用相关的
UIManager
键、
Table.background
Table.selectionBackground
使选择颜色等于背景颜色

UIManager.put("Table.selectionBackground", UIManager.get("Table.background"));
在acustom渲染器中,您可以指定相同的颜色,而不必考虑
isSelected