Java2d: ability to show select box while dragging mouse

I have an image in Java2d and I would like the user to be able to select any rectangular part of the image by left clicking and dragging. (similar to mspaint). How it's done?

Thanks.

+2


a source to share


1 answer


http://java.sun.com/docs/books/tutorial/uiswing/events/mousemotionlistener.html



SelectionDemo should be especially helpful.

+4


a source







All Articles