Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need advice, scrolling list of images

 
Michael Remijan
Author
Ranch Hand
Posts: 130
7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create something like Window Explorer's "thumbnail" view where If a directory has say 200 images I'll display only the first N which will be visible and as the user scrolls the others are displayed. I already know how to generate the images and display them but I'm looking for some advice on how I would implement this scrolling features. Anyone ever work on something like this?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you put all your 200 pictures into a JScrollPane?
 
Michael Remijan
Author
Ranch Hand
Posts: 130
7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that is what I have done. I have a JPanel inside a JScrollPane. The JPanel has a GridBagLayout. When I click on a directory a thread start which starts resizing the images and putting them into the JPanel; 3 column by how ever many rows are needed. With 200 images I sit there and watch the slowly watch as all the thumbnails are generated and it all works fine but I don't want to sit there for so long. What I'd like to do is to just generate however many images will actually be visible and when the user scrolls then the other thumbnails are generated. This will make the app more interactive instead of just sitting there waiting for all the thumbnails to be generated.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know a lot about images, but I do know that resizing graphics and pictures strains the chip. It is about the only thing which will make your chip break into a sweat.

Is it possible to resize your pictures at initialisation time, resave them as new .gif files, and then load them as thumbnails?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic