• Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane getting full, but not scrolling?  RSS feed

 
Dan Kao
Greenhorn
Posts: 18
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create a JScrollPane with buttons in it, but I noticed that when I try to scroll, the items all move into ONE row at the top of the JScrollPane. How do I have them vertical? Is there something wrong with the way I am setting up the JScrollPane? Thanks
 
Dan Kao
Greenhorn
Posts: 18
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changed original post.
 
Dan Kao
Greenhorn
Posts: 18
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured out how - to set the preferred size of the JPanel instead of the JScrollPane.
 
Rob Camick
Ranch Hand
Posts: 2754
12
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Don't set the preferred size of anything. Swing was designed to be used with Layout Managers. Let the layout managers do their job and you won't have problems.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!