|
|
@ -84,6 +84,16 @@ public class FineTableHeaderUI extends FlatTableHeaderUI { |
|
|
|
setHorizontalAlignment(SwingConstants.LEFT); |
|
|
|
setHorizontalAlignment(SwingConstants.LEFT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 是否选中修改背景 |
|
|
|
|
|
|
|
* @param isSelected 被选中 |
|
|
|
|
|
|
|
* @param columnClass 列类型 |
|
|
|
|
|
|
|
* @return 是否修改 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean checkSelected(boolean isSelected, Class columnClass) { |
|
|
|
|
|
|
|
return isSelected && columnClass != Boolean.class; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
|
|
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
|
|
|
Class<?> columnClass = table.getColumnClass(0); |
|
|
|
Class<?> columnClass = table.getColumnClass(0); |
|
|
@ -95,7 +105,7 @@ public class FineTableHeaderUI extends FlatTableHeaderUI { |
|
|
|
border = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), |
|
|
|
border = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), |
|
|
|
UIManager.getBorder("Table.cellNoFocusBorder")); |
|
|
|
UIManager.getBorder("Table.cellNoFocusBorder")); |
|
|
|
} |
|
|
|
} |
|
|
|
if (isSelected && columnClass != Boolean.class) { |
|
|
|
if (checkSelected(isSelected, columnClass)) { |
|
|
|
selectionBackground = UIManager.getColor( "Table.selectionBackground"); |
|
|
|
selectionBackground = UIManager.getColor( "Table.selectionBackground"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
selectionBackground = UIManager.getColor("Table.background"); |
|
|
|
selectionBackground = UIManager.getColor("Table.background"); |
|
|
|