How to add rectangle into a jscrollpane with a structure in Java
I'm trying to do a simple slide show program in java, and as you see in the image:
I want to add small rectangle's, which shows the slides like开发者_如何学运维 a powerpoint to a left side.
In left side, there is a JScrollPane
but I don't know how should I add a thumbnail which shows slide's contents.
How should I do that ?
Thanks
I would create ImageIcons of your images. You could show them in a JList in a JScrollPane or in a JPanel that uses GridLayout and that holds JLabels that hold the icons, again all in a JScrollPane. Myself, I much favor the JList solution as it makes it much easier to be able to select an image on mouse click.
As usual for this type of Swing GUI issue, the Swing tutorials should show you how to do all these things.
Edit: your comment to Andrew Thompson is a completely different issue and should have been mentioned in your original post. For more on that, please check out this article: perils-of-image-getscaledinstance
精彩评论