How to create a "click" event programmatically using javaXPCOM

Lawrence Tsang <[email protected]> Fri, 28 May 2010 19:08:00 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.java
Organization http://groups.google.com
Message-ID <[email protected]>
Hi All,

     As a new comer in javaXPCOM, I have some difficulties in creating
a mouse "click" event programmmatically. The codes that I have used
is :

nsIDOMMouseEvent clickEvent = (nsIDOMMouseEvent)
documentEvent.createEvent("MouseEvents");
clickEvent.initMouseEvent("click", true, true, (nsIDOMAbstractView)
domWindow, 1, 0, 0, 0, 0, false, false, false, false, 0, null);

where "documentEvent" is a nsIDOMDocumentEvent object and "domWindow"
is a nsIDOMWindow object.

     My program seems to have generated an exception after the 1st
statement. However, there is no exception message seen in the console
as these 2 statements are sat inside a nsIDOMEventListener object. The
Java system ignores the exception and proceeds to call other event
listeners. The program just seems to have ignored these 2 statements
and the statements below them.

     Does anyone have any idea on how to correct these 2 statements ?
Thanks.

Regards
Lawrence