I am currently working on a project involving drawing and such.
I will quickly describe my goal: I need to draw some lines and other polygons onto a JPanel. The JPanel will be roughly 500x500 and, of course, by default it is fixed there (so whatever is outside that range, is not shown). What I want to do is to catch, using a listener, the mouse movements and move the content of the JPanel accordingly.
The issue is that I did not manage to find the command for that :/.
Another question: if I draw a 'HUGE' amount of polygons and data onto the JPanel, will be all stored at the same time or will get memory only when it is painted and therefore shown? If not, what would you think would be the best way to overcome the extremely high amount of memory used? (I was thinking of just drawing stuff only if they are within a certain range ["buffer area"], but this might cause issues for very long/large. But of course, if Java is smart enough to not render the whole thing if it is outside the bounds, I am good to go )
Thanks in advance!