Get your CodeRanch badge!*
The moose likes Swing / AWT / SWT and the fly likes viewing large Jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "viewing large Jtable" Watch "viewing large Jtable" New topic
Author

viewing large Jtable

Daniel Roach
Greenhorn

Joined: Mar 12, 2002
Posts: 10
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

Joined: May 15, 2001
Posts: 18
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

Joined: Mar 12, 2002
Posts: 10
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

Joined: Mar 12, 2002
Posts: 10
Thanks Jagan it worked perfectly
 
wood burning stoves
 
subject: viewing large Jtable
 
Similar Threads
JTable
jtable
JTable
JTable
jtable