I’m building an isometric map editor that uses a large gif (5000x3000) as the base/ground layer. Before rendering the image to the screen I create a subImage so that I’m only drawing the portion of the image that is necessary.
The memory problem I’m having appears to be coming from the setPrefferedSize call I use on my jPanel. I want to create the jPanel as 5000x3000 pixels so that the scrollPane knows how large the scrollbars need to be. (The viewport of the scrollPane is the jPanel). The program crashes with a “java heap size” error before I can get anywhere close to 5000x3000.
So obviously using this approach sucks way too much memory. Maybe I’m not handling the scrollpane correctly? I’ve never tried creating a scrollpane on this large of an image before so it’s never been an issue.
My guess is that the jPanel shouldn’t be any larger than the screensize and that there is a better way to handle the size of the scrollpane.
(On a side note, just joined the forums today. I’ve worked with a fair amount of isometric stuff so if anyone has iso questions I may be able to help. My current project is rebuilding an old iso editor that I did in C many years ago.)