One more solution:

MouseEvent clicked = ....
JLabel l = ...

for (MouseListener ml : l.getMouseListeners()) {
    ml.mouseClicked(clicked);
}

But this solution only works if you don't have subclasses of JLabel
which override the #processMouseEvent(MouseEvent)-method.

On Thu, Jun 9, 2016 at 7:44 AM, Andrej Golovnin
<andrej.golov...@gmail.com> wrote:
> Hi Pete,
>
> you can either use java.awt.Robot or you can dispatch an event by
> calling java.awt.Component.dispatchEvent(AWTEvent).
>
> Best regards,
> Andrej Golovnin
>
> On Wed, Jun 8, 2016 at 10:46 PM, Pete Brunet <peter.bru...@oracle.com> wrote:
>> To add some accessibility support I need to programmatically click a
>> JLabel in a JList.  If I can figure out the code path for when this
>> happens with a real click I can probably do what I need to do but as of
>> yet I haven't figured it out.  Does anyone on the list know at least
>> part of the code path?
>>
>> Thanks, Pete

Reply via email to