셀 데이터에 따라 다른 색을 나타내야하는 JTable 구성 요소의 tablecellrenderer를 구현하고 싶습니다. 나는 이것을 얻었지만, 선택된 셀의 색깔을 바꿀 수는 없다.TableCellRenderer 선택한 셀 문제
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex)
{
if (isSelected) {
this.setBackground((Color)UIManager.get("Table.selectionBackground"));
this.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
} else {
this.setForeground((Color)UIManager.get("Table.foreground"));
this.setBackground((Color)UIManager.get("Table.background"));
this.setBorder(BorderFactory.createEmptyBorder());
}
...
}
을했지만 작동하지 않습니다 : 나는이 작업을 수행하려고 내가 셀을 클릭 할 때 JTable의 다른 아무것도 표시되지 않기 때문에 S는 .. 내가 문제를 볼 수 없습니다.