Here is a really nasty approach , which is the only approach I can come up with (and don't recommend):
- Set the glass panel
JFramecompletely red and show the glass panel (temporarily). - Use the class
Robotto select all pixels (or several pixels) from the coordinate of the screen where yours is located JFrame. - If all of your samples (or most of the samples according to some threshold) are red, then most likely nothing will be in front of yours
JFrame. - Finally, hide the glass.
Alternative (more pleasant solution)
Just call toFront()your own JFrameto bring him to the front and make sure he has focus.
source
share