I don't believe you can make the component not fill the cell, but you can add a border to the button in the custom renderer
class ButtonCellRenderer extends JButton implements TableCellRenderer {
private Border MATTE_BORDER = BorderFactory.createMatteBorder(2, 3, 2, 3,
UIManager.getColor("Table.background"));
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
setBorder(MATTE_BORDER);
// ...
return this;
}
}
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847