aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes To set Jtable height when the number of row increased? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "To set Jtable height when the number of row increased?" Watch "To set Jtable height when the number of row increased?" New topic
Author

To set Jtable height when the number of row increased?

Raji Raj
Greenhorn

Joined: Feb 18, 2011
Posts: 12
Hi All,

In jtable,i have given "setPreferredScrollableViewportSize".but i need to chnage the size of the table if the number of rows increaed.

Problem::
Since i have given the "setPreferredScrollableViewportSize",its taking only that size.I am increasing row by giving one button,if i change the "setPreferredScrollableViewportSize" in jbutton listener,there is no effect.

Please kindly help to resolve this.

Thanks,
Raj.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

First of all, why did you set it explicitly? What's wrong with letting the JTable calculate it for you?

Add a TableModelListener to the JTable's model, and listening for insertion and deletion events.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Raji Raj
Greenhorn

Joined: Feb 18, 2011
Posts: 12
Hi ,
Thanks for you reply.but Intially while lodaing the table how will it take the table height?

Thanks,
Raj
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: To set Jtable height when the number of row increased?