Java: Create a GUI with XML? Java: Create a GUI with XML? xml xml

Java: Create a GUI with XML?


I have had good experience with ANTForm: http://antforms.sourceforge.net/.

It generates Java Swing panels from XML. I have used it to build simple GUI apps that execute ANT targets.

Example of the XML declaration:

<antform title="Send Mail"     save="properties.txt"    image="doc/images/testlogo.jpg">    <label>To send a mail, use the following form. Pick a recipient, type a subject and a body...the script will do the rest.</label>    <selectionProperty label="Recipient: "     property="recipient"     values="address1@somewhere.com; address2@somewhere.com; address4@somewhere.com"     separator=";"/>    <textProperty label="Subject : " property="subject" />    <multilineTextProperty label="Message body: "        property="body"/>    <booleanProperty label="Send immediately: " property="send"/></antform>

Example of what it produces:

enter image description here


I would suggest checking out FXML there is a neat tool made by oracle which can be used for making GUIs the following are some good links to get started.

http://docs.oracle.com/javafx/2/fxml_get_started/jfxpub-fxml_get_started.htm

http://docs.oracle.com/javafx//scenebuilder/1/get_started/jsbpub-get_started.htm

You don't need to use the SceneBuilder tool but it makes things very easy when creating a gui using FXML.


I don't know if there are any popular frameworks out there for Java, but you might look at XUL which is what the Firefox UI and its plugins use.

There are some Java-based engines to render XUL (using Swing), but I'm not sure what state they are in.