This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane help  RSS feed

 
Peter Kirk
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to load a lot of thumbnails onto a JPanel, which is in a JScrollPane. The problem I am having is that the scroll pane does not generate a vertical scroll bar as the thumbnails increase beyond the visible screen size. I don't want horizontal scroll, only vertical if necessary.

Here is some example code. In reality, I'm loading a lot of different thumbnails. In ths example I just have one (100x150 pixels) which I load 100 times.



Thanks,
Peter
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the Wrap Layout.
 
Peter Kirk
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:Use the Wrap Layout.


Excellent! Amazing you have made the exact layout I needed :-)
I notice you don't have a package name in your class file, so I've called it "rob.camick.layout" in my project - hope that's ok!

/Peter
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!