Meaningless Drivel is fun!*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 19654
    
  18

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Zooming in and out - cursor not in the right place
 
Similar Threads
drawing arrows
Is there anyway of overriding the default signal for PopupMenus
Problems moving shapes when set up own Shapes class extending Path2D.Double
Help on zooming in on an image
Moving clickedShapes and only clickedShapes on a panel