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 08:48 AM.

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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57