Swing Rendering Engine

Typically, Swing UIs are handwritten or generated by custom designer tools (code generators), where code between the "do not modify" comments is getting ugly. No matter how it's done, the final Java byte-code determining the UI is created at compile time.

Inspired by the Thinlets project, SWIXML was created. SWIXML is a rendering engine that converts XML documents into javax.swing objects at runtime. Despite the fact that the SWIXML.jar file is only about 40Kbyte in size, almost all of the well known JFC/Swing objects are supported. However, a SAX-style XML Parser and the JDOM library (125K) are dependant modules, required to be available on the client.

A minimal HTML page loading the SWIXML rendering engine looks like this:

<body leftmargin=0 topmargin=0 bottommargin=0 rightmargin=0>
   <param name="xml" value="/xml/gui.xml"/>


The Applet requests an XML descriptor file from the server it was originally loaded form. (In the sample code, the gui.xml file is requested and loaded.) The content of this descriptor completely determines the GUI.


A minimal descriptor would look something like this:

<?xml version="1.0" encoding="UTF-8"?>
   <panel background="6699cc" constraints="BorderLayout.CENTER">
     <label text="Hello Swinglet"/>
     <button text="OK" tooltiptext="Press OK"/>

Resulting GUI:

Carlsbad Cubes Swixml, founded by Wolf Paulus
Copyright ©2003-2011 - Wolf Paulus. All Rights Reserved.
Email: [email protected]
All trademarks are property of their respective owners.