Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Zooming in and out - cursor not in the right place

 
Kieran Murray
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thread really belongs in the Swing / AWT forum so that's where it's going.
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a start.
 
Nikos Pougounias
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
About the zoom functionality in zoomup(), you may also carefully choose cx and cy for a smoother effect.
 
Kieran Murray
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic