tags:

views:

139

answers:

1

I have a JFrame with null layout and two one character JLabels on the same position.

When I add a MouseListener the MouseClicked event always goes to the first JLabel even if it has a transparent pixel there. Is there a solution for this?

(eg: I display "a" and "á" and I need to know if the user clicked on the character or on the accent)

A: 

IIRC, you need to call setOpaque false and override contains(int,int).

Tom Hawtin - tackline
Okay, but I found no "getpixel" like functions in the JLabel documentation. I need to render the text to some Image and use it as a reference?
Dutow
Found it, Robot.getPixelColor.
Dutow