Logo Member

Valid XHTML 1.0!

Valid CSS!

JFCML - JFC/Swing XML Markup Language

JFCML is a markup language for Java, which specifically targets the creation of AWT/Swing Graphical User Interfaces. More formally, JFCML is an XML User interface Language (XUL) for Java. JFCML has been designed to be easy to use, yet powerful enough to write a complete application. Using JFCML, it is possible to construct a complete, running Java application; without writing a single line of Java code.

Because JFCML uses Java's Reflection technology, the set of XML elements and attributes that can be understood by JFCML is not determined until run-time. JFCML can discover and use any Java class loaded by the ClassLoader, including your own classes.

JFCML also supports a wide array of scripting languages through the Bean Scripting Framework (BSF), including JavaScript, BeanShell, Jython, Jacl (Tcl), NetRexx, Groovy, and many more. JFCML also provides it's own scripting language - JFCMLScript. This is a tiny yet amazingly powerful expression language with Java-like syntax; which also uses the magic of Reflection.

Other similar solutions exist, but JFCML is the correct solution. JFCML was the first complete solution, and it will always be the easiest to learn:

If you can remember these 4 rules, you've just learned JFCML.

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MyRootPane extends JRootPane {
        public MyRootPane() {
            JButton button = new JButton();
            button.setText( "Hello World" );
            button.setForeground( new Color(255,0,0) );
            button.addMouseListener( new MouseAdapter() {
                public void mouseClicked( MouseEvent ev )
                    System.out.println("Hello from Java!");
            getContentPane().add( button );
        <Import package="javax.swing"/>
        <Import package="java.awt"/>
        <Import package="java.awt.event"/>
                    setText="'Hello World'"
                    setForeground="new Color(255,0,0)">
                        <MouseListener listener="
                            return new MouseAdapter() {
                                public void mouseClicked( MouseEvent ev )
                                    print(&quot;Hello from BeanShell!&quot;);

As you can see from this example, the JFCML document looks very similar to the Java code it represents. Additionally, the example demonstrates JFCML's ability to use scripting languages as "proxy" EventListeners.

Unlike many similar tools, JFCML does not require the programmer to implement a Java class. It is possible to "run" a JFCML document as any standard "top-level" AWT or Swing container from the command line. Of course, this may not be sufficent for non-trivial applications, and it may become necessary to write a Java class. While this is also supported from the command line, a simple API is provided to let the user invoke the JFCML interpreter from their own code. This API also includes mechanisms for extending the functionality of the JFCML interpreter.

The JFCML interpreter uses an event-driven SAX parser to process the XML file, significantly reducing the memory profile. Rather than construct a document tree, the document is processed serially using a stack machine. The memory usage should therefore increase more logarithmically, and is actually based more on the complexity of the file rather than it's size.

The potential benefits of defining windows with JFCML is limited only by the imagination. Coupled with a document Producer, one could implement a dynamic windowing system which could define and construct windows at run-time. Things like I18N and L10N are a snap when you already store all translatable text in an external file! A programmer could easily implement a skinnable look for thier application. The list goes on and on.

Project News

New Developer: Mr. Mathias Henze

June 5, 2005 I am pleased to announce that Mr. Mathias Henze will be joining the JFCML development team. Mr. Henze is a Senior Software Engineer for SKYTEC AG, based in Germany, where has worked with JFCML developing a commercial Rapid Application Development (RAD) framework.

Mr. Henze has impressed me with his rich knowledge of integrating Java and XML technologies. He has already contributed several fresh ideas to the project. I am truly honored to welcome him to the JFCML team.

JFCML at JavaOne 2K5

May 22, 2005 Hans Muller, CTO for Sun's Desktop Division, has recently informed me that he will mention JFCML at this year's JavaOne conference inSan Francisco (June 27-30th), along with some similar tools such as SwiXML.

"I'm doing a talk about declarative XML schemas for Swing GUIs at JavaOne this year and I'd like briefly cover JFCML. My impression is that you've taken roughly the same tack as SwiXML albeit with a very different implementation. One major architectural departure from SwiXML would have to be integrating with BeanShell. This seems like a nice way for developers to construction actions and layout managers although mixing scripts with declarative code is always a bit if a compromise."

JFCML Version 1.0 RoadMap

May 22, 2005 Inspired by this exciting news, I am actively developing this project once again. This project is finally nearing completion, and about to assert itself as the premeire XUL/embedded scripting solution for JFC/Swing.

Demo Section Online

Oct 8, 2004 The demo section is online - by far the coolest feature yet. You may enter your JFCML description and immediately view the results. The user is encouraged to revisit this section often while reading the tutorials. The demo uses a simplified file format: you MUST NOT enter an xml version string or document type definition. Because of the security restrictions on applets, these must be coded programmatically using the codeBase attribute of the applet. [Go There...]

Tutorials Section Updated

Oct 1, 2004 Updated tutorials section. First chapter (Getting Started) nearly complete. The preliminary "Hello World" example is complete. This example demonstrates the basic boilerplate code you will need when working with JFCML (and how much is eliminated by using JFCML!). [Go There...]