From: Daniel Luis dos Santos on
Hello,

I have a JTable with some columns. I am setting the widths of some
columns to some preferred size. One column has no header text, and the
cells have a check box. I want the cells of that column to have the
least amount of extra width around the check boxes. I set the preferred
size on the table column to be 1 or 0 and the there is always space
around the check boxes. Is it possible to remove that extra space. I
have the same problem on some other columns.

Those columns on which I am setting the width, I am also setting them
not to be resizable. But when I resize the window (and thus the table),
the non-resizable columns also resize proportionally. Can I tell them
to be fixed size no matter what width the table has ?

Thanks.

From: John B. Matthews on
In article <4b71f7ca$0$1900$a729d347(a)news.telepac.pt>,
Daniel Luis dos Santos <daniel.dlds(a)gmail.com> wrote:

> I have a JTable with some columns. I am setting the widths of some
> columns to some preferred size. One column has no header text, and
> the cells have a check box. I want the cells of that column to have
> the least amount of extra width around the check boxes. I set the
> preferred size on the table column to be 1 or 0 and the there is
> always space around the check boxes. Is it possible to remove that
> extra space. I have the same problem on some other columns.
>
> Those columns on which I am setting the width, I am also setting them
> not to be resizable. But when I resize the window (and thus the
> table), the non-resizable columns also resize proportionally. Can I
> tell them to be fixed size no matter what width the table has ?

You could override the check box's paintBorder() method or change the
borderPainted property.

<http://java.sun.com/javase/6/docs/api/javax/swing/AbstractButton.html>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>