About Us
Home
Contributors
License
Components
Sandbox
Jelly
Overview
FAQ
Getting Started
Tutorial
Detail
JellyDoc
Download
Tag Reference
Community
IRC
Powered By
To Do List
Features
JellyUnit
JellySwing
JellySWT
XML Pipeline
Core Tags
Tag Libraries
General Information
Charter
Volunteering
Contributing Patches
Releasing Components
Jakarta Community
Get Involved
Mailing Lists
Commons Resources (Unofficial)
Wiki
Japanese Translation
Korean Translation
Related
DB Commons
XML Commons

### JellySwing

JellySwing is a simple Jelly library which can be used to create Swing user interfaces. It allows XML documents (Jelly scripts) to be used to define the layout and rendering of Swing front ends which avoids lots of mundane Java coding, using markup to define the view of your front end and allowing you to bind to Java code for the business objects and models.

This mechanism uses seperation of concerns and MVC ideas from web applications, allowing the rendering of your Swing front end to be easily transformed (since its XML) into different styles while leaving your model and business objects untouched. It also allows different views to be constructed independently of your models.

There is an example JellySwing script here

To run the example type the following command (from within the `jelly-tags/swing` directory) and then you should see a full Swing user interface appear with pull down menus, a splitter pane, a form, entry fields, buttons and a table.

        maven demo:swing

This example even shows that simple actions can be coded in Jelly script too! Though typically most complex logic and models (such as TableModel, TreeModel) should be written in Java code. Then Jelly script can be used to create the view and bind in the models.

### JellyRunner

JellyRunner is a simple example Swing user interface written with JellySwing. You can view the source to it here

If you invoke it via the following command you will get a small Swing UI that allows you to choose Jelly scripts to invoke, within the current JVM. Again run this within the `jelly-tags/swing` directory.

        maven jelly:runner

This makes developing Jelly scripts and JellySwing scripts in particular, much more RAD-like. You can keep JellyRunner open, edit a Jelly script and just hit the 'Run' button and the script executes instantaneously, there's no waiting for a JVM to startup.

### Comparing JellySwing with Java code for Swing

There's a simple demo written by Otto von Wachter which demonstrates how Jelly can be used for templating HTML.

The demo was orignally written in Java code to implement a simple Swing UI As an experiment the same Swing user interface has been written as a JellyScript as well. While this is a fairly simple Swing UI and not a particularly great example of the power of JellySwing, it does highlight the main difference between the two appraches.