hi,
You will have to do
table.getColumnModel().getColumn(i)  and call setWidth() / setMaxWidth()/...
api to set the width.
To make it dynamic, either do it on resize() event or when the data model
changes.

And to
> - dynamically make the column resizable or not
> - dynamically make the column selectable or not
make appropriate calls whenever required.

And for
> - make the column width expand to fit all the header text
you will have to calculate the header width based on contents and
setMaxWidth() of that column.

> - automatically show horizontal scroll bars when columns
>  do not fit in the viewport area.
add using scrollpane, and set policy as,
setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)

-vanita.

You will have to do set
> Hi,
>
>    I need some code for a JTable that does these things:
> - dynamically resize the columns' width
> - dynamically make the column resizable or not
> - dynamically make the column selectable or not
> - make the column width expand to fit all the header text
> - automatically show horizontal scroll bars when columns
>  do not fit in the viewport area.
> I need to these things in code executed after the table has been shown
Does anyone have sample code for these things?
> Ravi.
>
>
>
>
>
>
>
> _____________________________________________________
> Chat with your friends as soon as they come online. Get Rediff Bol at
> http://bol.rediff.com
>
>
>
>
> _______________________________________________
> Swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/swing
>
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to