jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes Zooming in and out - cursor not in the right place Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Zooming in and out - cursor not in the right place" Watch "Zooming in and out - cursor not in the right place" New topic
Author

Zooming in and out - cursor not in the right place

Kieran Murray
Ranch Hand

Joined: May 18, 2008
Posts: 47
Hi Guys,

I am not sure if this should be in the intermediate forum. However here goes.
I zoom a drawing of a line and a circle. However, the cursor does not stay on the fix on the object being dragged.

There are two classes. The code is below;





The code is a hack of others code which has been very useful. Any help would be appreciated.

Kind regards,

Apprentice
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

This thread really belongs in the Swing / AWT forum so that's where it's going.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Here's a start.
Nikos Pougounias
Ranch Hand

Joined: Jan 16, 2008
Posts: 110
About the zoom functionality in zoomup(), you may also carefully choose cx and cy for a smoother effect.


Nikos' Java blog
Kieran Murray
Ranch Hand

Joined: May 18, 2008
Posts: 47
Nick and Craig,

Thanks for the replies. I will use your code Craig - it is a lot cleaner.
Got the message about the listeners and if on panel or on frame.
I removed this bit
if(ZoomPanel.hasHit(p))
because I want to move the whole panel.
The next stage will be to just move a line or circle.

Thanks for your help.
You can close this topic if you wish.

Apprentice
 
GeeCON Prague 2014
 
subject: Zooming in and out - cursor not in the right place