MozCreator XUL Parser - Create Swing UIs Using XML

Gerald Bauer <[email protected]> Wed, 9 Mar 2005 16:43:37 -0800 (PST)
Newsgroups gmane.comp.lang.xul.announce
Message-ID <[email protected]>
Hello,

   RJ Keller has created a new XUL parser that lets
you create - surprise, surprise - Java Swing
applications using XML.

   RJ Keller writes:

  Anyone who has ever used or even researched the
Mozilla platform knows the tremedious advantages of
using its GUI platform over Sun's Swing GUI layout.
Using XUL can make your application GUI much more
readable and easier to find bugs. It's also easier to
localize becuase you can use easy-to-use DTD files to
define XML entities instead of using properties files
defined by Java.

The goal of the XulParser project is to create a XUL
implementation for Java, but at the same time to take
some of Java's special features (that aren't defined
in XUL) and make them accessible through XUL using a
different namespace.

Architecture

XulParser will use JAXP (Java API for XML Processing)
to generate the GUI code to be displayed. Using this
parser comes with native support for DTD files and
easy accessing of XML tags and attributes.

Usage

Using XulParser is easy. Just create a XulFrame object
and take in the file name of your XUL file to the
constructor. XulFrame extends the JFrame class, so you
can run setVisible to show your GUI form and display
your XUL file! Obviously you need a way to get your
GUI elements in order to manipulate them. For all the
components that you need access to (like a JTextField
element), make a id attribute for them in your XUL
tag. Then use XulFrameObject.getElementById("idName")
to retrieve that item. getElementById returns a
JComponent corresponding to the ID you set in your XUL
file. Once you know the element, you can then safely
cast it to whatever component the XUL tag is.

Usage:

XulFrame frame = new XulFrame("C:/test.xul");
frame.setVisible(true);
JButton okBtn =
(JButton)frame.getElementById("okButton");

But XUL is not perfect, especially for Java
developers. In order to make XUL more appropriate for
Java, we added a namespace called JXUL which adds tags
and attributes to make XUL easier for Java developers.

   More @ http://mozcreator.mozdev.org/xulParser.html


  If anyone tries out the MozCreator XUL parser, let
us know how the MozCreator XUL Parser stacks up to
alternative XUL parsers for Java Swing such as Sulu,
Luxor, jzXUL, jXUL, SwixNG and so on.

   - Gerald


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click