• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable=> scrollpane problem

 
Sandhya Rprasad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
My GUI comprises of the following :
JAPplet => Bean =>( JScrollPane => JTable and some buttons)
I'm loading the table with some data . It has 4 columns and n rows with the rows increasing by the data loaded. I've made the last 2 columns hidden. Now, when I'm trying to add the data, my JTable is growing in size without the scrollpane appearing . This is covering up the buttons inside the bean since the JTable's size is >sing. Could somebody suggest me with a solution.I'd really appreciate a faster response.
Thanks
sandhya
 
Rob Loft
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here you go mate this method should sort it out as i had the same problem.
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
then set the scrollbar to appear always.
rob.
 
Sandhya Rprasad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Rob, Thanks for the response but the scrollpane becomes very small and still does'nt make the scrollbar appear. Okay, the problem is the last 2 columns are hidden(there are 4 columns).
So, what's happening is when I make the size of the bean small, instead of the vertical scrollbar appearing, a horizontal scrollbar sort appears on the vertical side of the scrollpane. Also the table is covering up the rest components of the bean. I guess this is a little weird to explain, but I've tried to be clear .. I hope. So, if you come up with some ideas, do let me know.
Thanks
Sandhya
 
David Freels
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the JTable to a JPanel and then add the JPanel to the JScrollPane. This helped me when I had this trouble.
Hope this helps.
David
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!