Jan Krakora Messages: 402 Registered: December 2009 Location: Prague
I would like to draw a line. The scenario should look like this:
The user selects "line creating tool" from the palette. The line could start only from the center of an existing figure, so the cursor should show "this is disabled" unless its over the figure.
Then user clicks and the line attaches itself to the center of the figure. After that user moves the cursor and so its determined the direction and length of the line. The line is drawn as feedback. Finally, the user clicks and the line is added to the graph.
How can I do that? I mean, do I have to create my own Tool for that? Its not about creating connections, right? Because a connection have always source AND target. So could somebody give me a kick how to realize this?
i am not far enough into this to tell you if its a connection,
but i try to do something similar.
actually i added listeners to my figures to see if mouse is over. if it is you can enable the mousecursor and allow a polyline to be drawn (can a connection exist with source only? i dont know - i use a polyline) then a second mouselistener tracks mouse movement and clicks so you can preview the line and add new points on clicks.