I'm trying to use the scrollbars of a JScrollPane to simulate scrolling in a Canvas (JPanel). The panel has a fixed size and an image will be drawn inside it using paintComponent
.
I need to be able to zoom in (and scroll around), but I only want the image to zoom, while keeping it's JPanel the same fixed size. I try to avoid making my own scrollbars inside of the panel (by drawing them, listening for mouse events and such things).
Is it possible to use a JScrollPane to manage the offsets and just altering the size of my image/scaling it up when it gets painted, without ever touching the bounds of my JPanel?
The initial reason for this is that I'd like to manipulate pixel data as an array, which does not work well if I need to resize the panel...
Thanks in advance -