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.oji
Organization http://groups.google.com
Message-ID <435c0bac-f938-4583-9123-43a207bd2d75__48545.1218359687$1275099037$gmane$org@11g2000prw.googlegroups.com>
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