-1

I'm cropping a image in java swing, but when I select a part of image for cropping, I need to make selection part visible to user. Like a transparent rectangle on that image.

vicky
  • 1,046
  • 2
  • 12
  • 25

1 Answers1

2

GraphPanel shows one approach to rendering such a selection rectangle, mouseRect. The rendering is controlled by the boolean selecting attribute.

Addendum: Once you know the bounds of the selection, you can use getSubimage() to clone the corresponding part of the image. There's a related example here.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045