• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Draggable Group

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hallo all,
I need your help.
I'm trying to make some circle with label on it. After some searching, I found that to make a circle with label on it is to put it on a group.
The problem is now, as I'm trying to apply mouse dragging on that group, I don't get correct posX and posY for circle's new position. And it looks like that my dragg running with lags.
Here's my code, I hope you can get me some suggestions.
 
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> I don't get correct posX and posY for circle's new position

Here some sample code with the correct mathematics for the drag operation:



This is based on the related StackOverflow question:

* http://stackoverflow.com/questions/10682107/correct-way-to-move-a-node-by-dragging-in-javafx-2

> And it looks like that my dragg running with lags.

To get minimize of lag in the drag set: -Dprism.vsync=false as suggested by Xanatos for:

* http://stackoverflow.com/questions/10682107/correct-way-to-move-a-node-by-dragging-in-javafx-2

Note, I still get some lag with vsync set to false, but it is pretty minimal.
 
Otto J. Lee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot! That's really what I need.
I will need a lot of those circle on my application, so I expanded your solution to my needed.
I will have some of those "circles" connected with each other, and that line have to react to the change of circle's position. So, I wrote:



I'm trying to follow this one:
https://gist.github.com/jewelsea/1441960

My questions now:
What have I missed from that example in my code? My line doesn't react to the circle's move.
And, is that possible to directly get the centerX and centerY from class StackPane contain my circle?
Sorry for this newbie questions.

Thanks a lot in advance!
 
John Damien Smith
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For how to drag around circles that are connected by a line, see:

http://stackoverflow.com/questions/19748744/javafx-how-to-connect-two-nodes-by-a-line
 
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic