aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Need advice, scrolling list of images Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Need advice, scrolling list of images" Watch "Need advice, scrolling list of images" New topic
Author

Need advice, scrolling list of images

Michael Remijan
Author
Ranch Hand

Joined: May 29, 2002
Posts: 126
    
    5

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?


Java EE Evangelist — Author, EJB 3 in Action 2nd Edition — Java Community Process Member
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Can you put all your 200 pictures into a JScrollPane?
Michael Remijan
Author
Ranch Hand

Joined: May 29, 2002
Posts: 126
    
    5

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

Joined: Oct 13, 2005
Posts: 40052
    
  28
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need advice, scrolling list of images