Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   JTable column sizing (http://www.velocityreviews.com/forums/t714502-jtable-column-sizing.html)

Daniel Luis dos Santos 02-10-2010 12:03 AM

JTable column sizing
 
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.


John B. Matthews 02-10-2010 03:05 PM

Re: JTable column sizing
 
In article <4b71f7ca$0$1900$a729d347@news.telepac.pt>,
Daniel Luis dos Santos <daniel.dlds@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>


All times are GMT. The time now is 01:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.