draw on big panel
I'm working on one graphical editor using java2d.
My JPanel is very wide (up to 8 million pixles) and is located in JScrollPanel.
I would like to know is there a way to draw it and not to be too slow?
There is option to draw background in BufferedImage and at every display draw from that image on panel with all changes made in editor by user. The problem is that the image is too big to be kept in the memory.
Second option is to draw only that what is currently showed in the panel but then it must calculate which part is seen and what to draw.
Is there any other way/trick?