Forums Register Login

JScrollPane + JPanel + zooming probs

+Pie Number of slices to send: Send
hi, i have a problem combining JScrollPane + JPanel and adding a 'zoom' function. Right now i have a class that extends a JPanel with a paint() method and two methods which called can perform a zoom function - really just doubles the size of the JPanel and called to repaint with the new location of things.
All the above is also in a JScrollpane so if the JPanel gets to big, its scrollable - This bit works fine.
The problem when i want to zoom in/out i want it to zoom in at the point of where it was before clicking to zoom. Right now everytime i do a zoom, the viewable area focusese on the top left of the JPanel (i think maybe because it retains the last coords of the viewed area?) instead of zooming in on the area viewed before zoom.
+Pie Number of slices to send: Send
Check out javax.swing.JScrollPane.getViewport() and javax.swing.JViewport.setViewPosition()
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2200 times.
Similar Threads
JPanel - Zoom out
JScrollPane in JInternalframe and JPanel in JScrollPane
Scaled BufferedImage woes
JScrollPane, JPanel & Scale mehtod.... not working
Javascript+HTML HELP.....URGENT....
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:19:37.