-1

how do i make a part of the JLabel, relative to the position of the mouse, visible only under the location of the mouse. the JLabel has an image of a room. i want the mouse to act as a flashlight, and only display, in a large circumference around the mouse the part of the JLabel/image that the mouse is hovering over.

noobAlert
  • 27
  • 3
  • 1
    With some difficulty, for [example](http://stackoverflow.com/questions/15488853/java-mouse-flashlight-effect/15489299#15489299) and [example](http://stackoverflow.com/questions/18388942/clear-portion-of-graphics-with-underlying-image/18392674#18392674) – MadProgrammer Jan 29 '17 at 22:05
  • wow this is great, thank you. – noobAlert Jan 29 '17 at 22:10

1 Answers1

1

Use a JLayer.

Read the section from the Swing tutorial on How to Decorate Components With the JLayer Class for various examples.

The section on Responding to Events has an example that does what you want.

camickr
  • 321,443
  • 19
  • 166
  • 288