سؤال

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)

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top