Invisible column in JTable

I

Ike

Anyone know how to make a column invisible in a JTable? I have tried setting
the width of the column to 0, but it still shows up with elipses (...) in
the column and hence a nominal width.

Anyone ev er encountered this? Thanks, Ike
 
E

Eric Sosman

Ike said:
Anyone know how to make a column invisible in a JTable? I have tried setting
the width of the column to 0, but it still shows up with elipses (...) in
the column and hence a nominal width.

removeColumn() seems a good bet.
 
D

Daniel Dyer

Not really sure why you want to do this but if I were to really hide
a column I would tinker with the data model so that its TableModel
interface returns less data than what the model really contains.
Of course one would need to add a couple of new methods for enabling
the hidden data somehow.

That's along the right lines, but use the TableColumnModel rather than the
TableModel, it makes things easier.

Dan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top