| Author |
How to trigger a mouse event with out MouseListener
|
Varatharuban B
Greenhorn
Joined: Feb 04, 2008
Posts: 5
|
|
Hi
Is there any way to trigger any MouseLister callback methods (mouseClieked(), mousePressed(), etc ...) without MouseListener ?
OR
Can I call mouseClicked(MouseEvent e) method manually ? If YES, how can I pass the MouseEvent ?
Can any one please help me ?
Thanks in advance
Regards
Varatharuban
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
I guess you're talking about Swing ? On which component do you want to do that ? Some components, like JButton, have a doClick() method to simulate a mouse click.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Varatharuban B
Greenhorn
Joined: Feb 04, 2008
Posts: 5
|
|
Yes. This is based on JApplet.
But I have to generate or call that mouseClicked() event without any mouse events.
Can I generate the same method using programming, with out event ?
Thanks
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
You could call dispatchEvent(AWTEvent e) and pass it a MouseEvent.
|
 |
 |
|
|
subject: How to trigger a mouse event with out MouseListener
|
|
|