Hi all,

there is a JTable and the cell in one column is set to button by set a customize cell render.
However, the size of the button occupies the whole cell region that is not what I want. How can I set fix size to it?


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, 

    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {


        // ...

        return this;