OOP-ResearchMake It Simpler by Object Oriented Programming

OOP XMLPanelEdit : Java Swing GUI tool / Java Swing GUI builder / Java Swing GUI by XML / XML Editor for Java Swing GUI

Java Swing GUI tool by OOP-Research. By this XML editor, Java Swing GUI can be written in XML. And JComponents on JFrame, JDialog or JPanel can be generated from XML. XML makes Swing GUI i18n ready.

XMLPanelEdit consists of Java Swing GUI tool (Java Swing GUI builder) and abstract Java classes.
Java Swing GUI tool included in XMLPanelEdit is the XML editor for representing the Java Swing GUI in XML. By this XML editor (Java Swing GUI tool or Java Swing GUI builder), you can easily define your Java Swing GUI in XML.
JPanel on JFrame or JDialog can have any Layout, i.e. FlowLayout, BorderLayout, BoxLayout and GridLayout. So, you can place JButton, JCheckBox, JRadioButton, JLable, JTextField or any other JComponents anywhere within JFrame, JDialog or JPanel. The Java components can be placed on the intermediate Swing containers, such as JTabbedPane, JSplitPane and JScrollPane. For example, JTable, JTree, JTextArea or JTextPane can be placed on JScrollPane. When BorderLayout is specified as the Layout, JToolBar with Actions can be placed on JPanel, and JMenuItems with the same Actions can be embed into JMenu.

You can prepare XML for your Java Swing GUI in as many human languages as you like, i.e. XML for your Swing GUI can be written in Japanese Shift_JIS, Chinese BIG5, Chinese GB2312 and Russian KOI8-R. By ResourceBundle read from the property resource file, the XML appropriate for the user's Locale will be selected at runtime. By this way, your Java Swing GUI can be internationalization (i18n) ready.

The abstract Java classes in XMLPanelEdit represent JFrame, JDialog and JPanel. These Java classes parse the XML written by Swing GUI tool and generate your Java Swing GUI. And your Java Swing GUI can access all the JComponents placed on it. For example, ActionListener can be added into JButton on JDialog. Or Actions on JToolBar and their corresponding JMenuItems on JMenu can be enabled/disabled at the same time.

Latest version: 2.1

The latest version of XMLPanelEdit is 2.1. The earlier version depends on Apache Xerces, but it is no longer required. Instead, XMLPanelEdit Version 2.0 (and later) depends on JAXP that is shipped with JDK 1.4.

The distribution file of your application developed by XMLPanelEdit Version 2.0 (and later) can be much smaller in its size now. But, at the same time, it can work only on JRE 1.4 or later. If you need to make your applications compatible also with JDK 1.3, the earlier version of XMLPanelEdit will be required. In this case, please feel free to contact us.

Related Pages:


Swing, Swing, Swing!

JFC Swing is the set of GUI related Classes supplied with JDK1.2 or later. Especially, JTable, JTree, JList and the subclasses of JTextComponents are easy to update their contents due to the Model-View-Controller architecture, which means the centralized data can be shared by client programs over the net.(Note: All other Swing GUI components are also based on the Model-View-Controller architecture.) And Swing GUI components are Event-driven, which enables us to define how each component respond to the actions from the users at our hand. With these characters, we can take the full advantage of OOP and build up the enterprise oriented GUI easily.

Image of ViewDialog
View Full image

Go Site Map

And what do we need?

While the Java Swing (JFC) provides us Freedom of programming depending on its sophisticated concept, it is still somewhat tedious work to define how our GUIs can be represented on the screen, especially as for the position and the size of the each component. For example, even in case that we want to re-position a button on our GUI slightly more left, we have to modify our source code and recompile it again. And in case of somewhat complicated GUI Class, the most portion of our source code may be the GUI-related one, which leads to the difficulty for reading and manage it.
How happy we are if we can modify our GUI without touching any fragment of our source code! It is desirable to get rid of the portion of placing the GUI components from our source code. To archive this, we need the alternative way to represent the structure of our GUIs other than writing them in our source code directly.
The Swing based GUI has the nested structure, which means that some container component holds other atomic level components as its child components. Such a container component knows how to place its child components in it. And each component has a set of the attributes which determines how it is represented, such as the size, the alignment, the font, the background color and so on. This means that we can represent the structure of our GUI in some abstract way. And as your know, XML is suitable solution for such a case.(XML is the way to represent the data along with its meaning.) The following is the quote from xml_panel_1_3.dtd, the DTD for representing Java Swing based GUI.

<!ENTITY % panel.mdl
        "layout?,size?,border?,toolbar?,panel.child*">

<!ELEMENT panel (%panel.mdl;)>
<!ATTLIST panel
          %opaque.att;
	  %panel.name.att;
	  %alignmentX.att;
	  %alignmentY.att;
          %label.text.att;
	  %label.image.att;
	  %layout.border.constraint.att;
	  %access.name.att;
	  %access.descript.att;
	  %color.fg.att;
	  %color.bg.att;>


And the fragment of the XML document looks like this.
<panel opaque="false">
<layout>
<layout.border/>
</layout>
<size>
<preferred>
<dimension dimensionX="500" dimensionY="300"/>
</preferred>
<max>
<dimension dimensionX="500" dimensionY="300"/>
</max>
<min>
<dimension dimensionX="500" dimensionY="300"/>
</min>
</size>
<border border="RAISED">
<insets insets.bottom="10"
    insets.left="10"
    insets.right="10"
    insets.top="10"/>
</border>
<toolbar opaque="false"
    toolbar.direction="horizontal"
    toolbar.float="false"
    toolbar.layout.border.constraint="NORTH">
<insets insets.bottom="5"
    insets.left="5"
    insets.right="5"
    insets.top="5"/>
<toolbar.child>
<component class.name="javax.swing.JLabel"
    editable="false"
    label.text="Select!"
    opaque="false"
    value.name="label"
    wordwrap="false"/>
</toolbar.child>
.....


Now that it is easy to understand that any Java Swing based GUIs can be represented in XML if you are familiar with XML. (In case that it is not true for you, please understand that any Java Swing based GUIs can be represented in pre-formatted text file.) Moving the GUI-related part of our source code into the XML document makes it possible that we can concentrate on designing how our Class should work, without bothering about how it will be represented on the screen, and we can modify our GUI without touching any part of our source code. And this also ensures the integrity of our source code. Now all we need is the XML editor for writing such XML documents and the parser which reads our XML documents and generate expected Java Swing GUI.
And voilà, OOP XMLPanelEdit
To make our life easier, OOP-Research developed OOP XMLPanelEdit (XMLPanelEdit for short), which consists of the XML editor for Java Swing GUI and the corresponding parser which generates the GUI objects from XML. It also provides us with the well-designed abstract Classes, by which we can use XMLPanelEdit without knowing about XML at all.

Go Site Map Read More

Caution!
All the APIs for Servlet/JSP introduced by this web site are now included in Bento framework:
  • Simpler than JSTL or Apache Struts
  • MVC framework by HTML
  • Input validation from CGI FORM
  • Easy user authentication
  • Easy localization (L10n)
To download the APIs and source code examples, please visit the web site of Bento framework.


JBuilder 2007


General Information

For Java Development

Java and all Java-based trademarks and logos are trademarks or registered of Sun Microsystems, Inc. in the United States and other countries.


ALL CONTENTS COPYRIGHT 1997-2007, OOP-Research Corporation. All rights reserved.