Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JTable column size

Reply
Thread Tools

JTable column size

 
 
moongeegee
Guest
Posts: n/a
 
      09-19-2007
I have a table contains many columns. One of columns contains
checkbox. I have tried the following code to set the size, but the
size is still too big. Please advise. Thanks.

table.getColumnModel.getColumn(4).setPreferredWidt h(5);
or

table.getColumnModel.getColumn(4).setPreferredWidt h(1); <== the
smallest number I can set.

 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      09-25-2007
On Wed, 19 Sep 2007 17:04:37 -0000, moongeegee <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

>I have a table contains many columns. One of columns contains
>checkbox. I have tried the following code to set the size, but the
>size is still too big. Please advise. Thanks.


Perhaps the problem is that JCheckBox has a label, and some space to
separate the label from the label. I take it you have an empty label?

I take it by "checkbox" you really mean JCheckBox.

To get it smaller, I think you will have to create your own label-less
component, cannibalising or overriding the JCheckBox code, and writing
a custom cell renderer.

You might even be able to do it simply with setPreferredSize
setMaximumSize to chop off the label.

--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Putting a JTable inside a JTable cell? Tivo Escobar Java 1 04-12-2007 11:09 AM
How to move data from a CSV file to a JTable, and from a JTable to a CSV file ? Tintin92 Java 1 02-14-2007 06:51 PM
Different Renderer type per row in same column of JTable? RobE Java 2 08-12-2003 06:12 AM
cannot print JTable column header cluenek Java 0 07-18-2003 03:40 PM
Adjust column widths of JTable Gerhard Rapp Java 0 07-18-2003 02:58 PM



Advertisments