How to create an XML based GUI program

The meta data of all Components we have created so far are stored as XML. The GUI builder is able to create Java Components with this information, and so are you. Within our SpeedJG.jar file resides a SpeedJG.class, capable to generate a GUIObject with the GUI information stored as XML.

To extract the XML information from our tool, we again select the frame in the meta-data tree and press the Generate XML Meta Data button in the toolbar. Now we have the content as text information and we store this information in a file named MyJFrame.xml.

Afterwards we save our as and keep only the following code lines:

import speed.util.*;

public class MyJFrame2 extends MyJFrameController
{ public MyJFrame2() throws Exception
  { super(SpeedJG.CreateGUI(XMLDocument.fromFile("MyJFrame.xml").getContent()));;
  public static void main(String[] args) throws Exception
  { MyJFrame2 myJFrame = new MyJFrame2();

Now compile this newly created program and you will see that it works like the old one. The trick is that SpeedJG dynamiclly generates the GUIObject that is passed to the controller from XML; and this works perfectly because we have a state-of-the-art MVC separation!