Question

I have a Graphics2D and I draw on it some elements (circle for example) I want to be able to select every circle and change its place in my graphe (let's say change its coordinates in the Graphics2D)

Was it helpful?

Solution

Take a look at Oracle's tutorial: http://docs.oracle.com/javase/tutorial/2d/advanced/user.html

They describe how to recognize clicks within the Graphics2D. They also show how to move a single shape. You have to advance this approach a little bit in order to support multiple elements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top