Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To set Jtable height when the number of row increased?

 
Raji Raj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Raji Raj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Thanks for you reply.but Intially while lodaing the table how will it take the table height?

Thanks,
Raj
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic