是否可以为JTable中的单元格设置selectionBackground透明?
table.setSelectionBackground(??);
感谢。
答案 0 :(得分:0)
您可以将自定义TableCellRenderer添加到JTable
public class CustomTableCellrenderer implements TableCellRenderer {
JLabel label = new JLabel();
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
label.setText((String) value);
label.setOpaque(!isSelected);
return label;
}
}