a. On start, it draws 3 circles on screen (either thro drawoval or by loading a circle image). b. Draws lines between the circles. c. Now I should be able to drag and move any of the circles at a time around the screen and it creates new lines from that to the other circles and kills the old lines which were initially drawn.
I have no idea how to start or how to go about doing this either by using AWT or Swing or DND. Pls advise and provide useful links
Joined: Mar 26, 2002
Here are some ideas.
a. On start, it draws 3 circles on screen (either thro drawoval or by loading a circle image). sounds like you probably already know how to do this. if not, check out the Graphics API
c. Now I should be able to drag and move any of the circles at a time around the screen and it creates new lines
I hear that java supports drag and drop guis, though have never done this myself. You could [URL=http://www.google.com/search?q=java+drag+and+drop&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US fficial]google for info on this[/URL].
Alternatively, you could implement your own drag and drop operations. You would need, at a minimum: -A datastructure modeling the circles you've drawn on the screen and their current locations. - A datastructure modeling the end points of lines between circles. - Mouse listeners that use the first datastructure to determine whether you've clicked in a circle and use the second data structure to update the lines between the circles.