• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic