I'm now to this forum and also a java beginner.
I've a problem with the image viewer I build. If I change the picture which will be showed (via drawImage(). repaint()) my memory usage increases everytime. So when I just switched through 20 pictures the memory usage of program ist near 250mb. The JFrame contains only a JPanel (in this Panel ist the ImagePanel on which the picture ist drawn) and 2 Buttons to switch through the pictures.
here's the code to draw the image on the ImagePanel (which extends JPanel) [ImagePanel class]:
After clicking on the "next image"-button I call this method from [class which rendering the gui and holds the ImagePanel (ip) object]:
Does someone have a idea how to hold the memory usage low?
Thanks for any answer !
Pascal Jay Jonasson
Joined: Jan 08, 2011
I got a solution from another forum, thanks to KrokoDiehl from java-forum.org.
The solution ist to use a BufferedImage with Image.IO instead of an Image with ImageIcon.