JPanel
. You can put it in any Swing structure you want.<window title="Example" width="200" height ="200" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button id="myButton" value="Push Me!"/> </window>And the following java code which add this XUL file to the ScriptManager:
ScriptManager manager = new DefaultScriptManager(); XULDocument document = manager.addXULScript(<the XUL file>);You can perform on the Swing root associated with the document:
XULSwingPanel panel = document.getRootComponent(); panel.addActionListener(new XULActionListener() { public void actionPerformed(XULActionEvent event) { System.out.println(event.getWidgetID() + " clicked"); } });
document
property, such as: var widget = document.getElementById("open");On other script type, you can get it through the ScriptHelper:
XULDocument doc = helper.getCurrentDocument();
ID
attribute) with the following method:
On Javascript scripts, you can also use the document
property, such as: var widget = document.getElementById("open");You can get the current widget which is the source of the last user event by one of the following methods:
var widget = document.getcurrentWindow();
Copyright 2008-2020 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence