Author
Hiding JTable Columns
Ajit Kumar
Ranch Hand
Joined: Jan 27, 2001
Posts: 81
posted Jan 28, 2001 18:51:00
0
Hi, How do i hide a specific column in a JTable object.? Setting setPreferredSize to 0 is not working. Any suggestions? Thanks
deekasha gunwant
Ranch Hand
Joined: May 06, 2000
Posts: 396
posted Jan 30, 2001 03:08:00
0
Hi Ajit, to set the columnwidth to zero u need to set all three setMaximumWidth(0); setPreferredWidth(0); setMinimumWidth(0); setPreferredWidth(0) does not work alone. regards Deekasha
Skip Cole
Ranch Hand
Joined: Jan 05, 2001
Posts: 174
posted Mar 06, 2001 13:51:00
0
Hi, This is not working for me. I still get a phantom column, about 1 character wide. I have tried and tried to make it go away, but it persists. Any ideas? Skip
If you love me, you will visit docs.opensimplatform.org
(FYI, Getting it tattooed on is a bit much.)
Skip Cole
Ranch Hand
Joined: Jan 05, 2001
Posts: 174
posted Mar 06, 2001 13:59:00
0
I finally found the answer! column = table.getColumnModel().getColumn(col_numb_to_be_hidden); table.removeColumn(column); Skip
Sandhya Rprasad
Greenhorn
Joined: Mar 01, 2001
Posts: 24
posted Mar 06, 2001 14:29:00
0
Try this !! It worked for me !! Good luck .. Sandhya TableColumn column1 = null; column1 = JTable1.getColumnModel().getColumn(no. of the col you want to hide); column1.setMaxWidth(0); column1.setMinWidth(0); column1.setWidth(0); column1.setPreferredWidth(0);
keiyia jackson
Ranch Hand
Joined: Jul 16, 2001
Posts: 49
How do you hide more than one column and make it/them return when you want???
carlo serantonio
Greenhorn
Joined: Oct 16, 2004
Posts: 2
Hi. I use following solution for alternate visibility of two column: Thanks for suggest. [ October 16, 2004: Message edited by: carlo serantonio ]
subject: Hiding JTable Columns