I put the ImageIcon on a JLabel and then put the label in the scrollpane. Give that a try and if you have no luck then post some code.
Joined: May 25, 2004
Hello Rachael. I tried that with ImageIcon. but what I am dealing here with is a BufferedImage which I don't think I can assign to a JLabel, unless I am wrong.
The reason I am using a BufferedImage is to take advantage of the BufferedImageOp and AffineTransform classes/methods.
I will look further at getting a BufferedImage inot the JLabel.
Joined: May 18, 2004
Sorry for reading your post wrong! I thought you wanted to display the ImageIcon.
(Aside I found that I could make the BufferedImage into an ImageIcon but then everytime I changed the BufferedImage I kept having to reflect the change in the ImageIcon.)
Then I found the better solution...
I had to create my own component that extends JPanel and I use Graphics2D to draw the image onto the component using drawRenderedImage(...).
The other reason that I went with making my own component was that when including any component in a JScrollPane, I found that the pane expands the component it holds. So on my custom component I could control the getPreferredSize a little better.