Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

viewing large Jtable

 
Daniel Roach
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a large Jtable (300 columns), how do I obtain a scrollbar so I can view columns which do not fit onto the JScrollpane?
Thanks
 
Jagan Mohan Reddy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Think the below sample code might solve ur problem..
table = new JTable(3,300);
table.setAutoResizeMode(table.AUTO_RESIZE_OFF); // Used to set the Auto resize in the off mode..
scrollPane = new JScrollPane(table);
table.setPreferredScrollableViewportSize(new Dimension(50,50));
getContentPane().add(scrollPane);
Regards,
Jagan Mohan Reddy
 
Daniel Roach
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jagan Mohan Reddy:
Hi,
Think the below sample code might solve ur problem..
table = new JTable(3,300);
table.setAutoResizeMode(table.AUTO_RESIZE_OFF); // Used to set the Auto resize in the off mode..
scrollPane = new JScrollPane(table);
table.setPreferredScrollableViewportSize(new Dimension(50,50));
getContentPane().add(scrollPane);
Regards,
Jagan Mohan Reddy
 
Daniel Roach
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jagan it worked perfectly
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic