Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Handle mouse events in zoomed in view

843806May 1 2008 — edited May 12 2008
I 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)?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2008
Added on May 1 2008
19 comments
1,032 views