Handle mouse events in zoomed in view
843806May 1 2008 — edited May 12 2008I am creating a Swing JPanel that zooms and magnifies its contents. Drawing this is straightforward, I just override paint() and set a scaling factor on the graphics.
The challenge I am running into is with making the contents clickable, like a normal JComponent. For example, if I have a JCheckBox that is at (25,25) at 100%, it will be drawn at (50,50) when the component is zoomed up to 200%. Is there a good way to translate mouse clicks so that when the user clicks on the component that they see painted at (50,50) it will be treated as a click on the real JCheckBox at (25,25)?