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
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.
Joined: Oct 13, 2005
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?