I'm trying to load an image, rescale it, and draw it on a panel.
After loading an Image and using getScaledInstance printed nothing, I read that one should use BufferedImage. However, the following code produces only a black box, until forcing a repaint by changing the size of the window or minimizing.
Why? Thanks a ton, Rikki
[ October 02, 2004: Message edited by: Rikki Bostelmann ] [ October 02, 2004: Message edited by: Rikki Bostelmann ]
posted 11 years ago
A variation in option two above (xform) is to make the scaled image one time and then render it in paintComponent vis–a–vis scaling it each time it is rendered. The approach shown above is better suited for ongoing image manipulation while this (suggested variation) is better if you do not need to make anymore changes in the scaled image, such as in a background image for a JPanel.