dcsimg
Swing JTable
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sandeep_Ipte
Posted On:   Wednesday, April 11, 2001 02:58 AM

How to specify/set the width of Column in JTable.

Re: Swing JTable

Posted By:   David_Rennalls  
Posted On:   Wednesday, April 11, 2001 04:00 AM

I beleive you can use getColumnModel() on the table and then getColumn(int index) to get the column you want. From there you can call setMaxWidth() and setMinWidth() of the columns.





...

JTable table = new JTable(...);

JColumn column = table.getColumnModel().getColumn(0);

column.setMaxWidth(50);

column.setMinWidth(20);

...






Or you could also create a custom TableColumnModel that sets up the widths for you and instantiate the JTable using that.
About | Sitemap | Contact