OOP-ResearchMake It Simpler by Object Oriented Programming

DTD of XML for Java Swing GUI, Java Swing GUI tool, i18n, OOP-Research

By this DTD, the nested structure of Java Swing GUI can be defined in XML. XMLPanelEdit consists of Java Swing GUI tool (Java Swing GUI builder) and abstract Java classes. Java Swing GUI Tool of XMLPanelEdit is the easy-to-use XML editor and you need not know about XML. Once you decide the nested structure of your Java Swing GUI, this XML editor will represent it in its JTree and write it into the XML.

This page shows the DTD of the XML generated by XMLPanelEdit. In this DTD, the root of the XML is always JPanel, because JPanel can be embed into JFrame, JDialog or JApplet. The rest of the JComponents are defined as the children of the root JPanel. LayoutManager can also be defined as the child element of JPanel. By the help of FlowLayout, BorderLayout, BoxLayout or GridLayout, you can place JButton, JCheckBox, JRadioButton, JLable, JTextField or any other JComponents anywhere you like.
JPanel itself can be the children of the root JPanel, and these JPanel can have their own LayoutManager as child element. By this way, the nested structure of your Java Swing GUI can be defined by this DTD.
In addition, JTabbedPane, JSplitPane or JScrollPane can also be the child elements of JPanel. For example, JTable, JTree, JTextArea or JTextPane can be placed on JScrollPane.
When BorderLayout is specified as the LayoutManager of the root JPanel, JToolBar with Actions will appear on JPanel. In this case, JMenuItems with the same Actions can be embed into JMenu.
As of version 1.3 of this DTD, JSlider can be specified as the child element of JPanel and you can edit its properties. For example, you can specify the minor ticks and major ticks of JSlider in the XML.

You can prepare XML for your JFC Swing GUI in as many human languages as you like, i.e. XML for your JFC 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 JFC 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 JFC Swing GUI. And your JFC 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.

Related Pages:

JFC Swing and i18n Related Links:




<!-- XML xml_panel DTD Version 1.3 -->
<!-- ALL CONTENTS COPYRIGHT 2000-2002, Jun Inamori. -->
<!-- All rights reserved. -->
<!-- Any questions and comments are welcome to -->
<!-- jun@oop-research.com -->

<!-- Start of Entities -->

<!-- Entities for characters and symbols -->
<!ENTITY lt     "&#38;#60;">
<!ENTITY gt     "&#62;">
<!ENTITY amp    "&#38;#38;">
<!ENTITY apos   "&#39;">
<!ENTITY quot   "&#34;">

<!-- Entities for classes of standalone elements -->

<!ENTITY % component.class "component">
<!ENTITY % tab.pane.class  "tab.pane">
<!ENTITY % panel.class     "panel">
<!ENTITY % scroll.class    "scroll">
<!ENTITY % toolbar.class   "toolbar">
<!ENTITY % action.class	   "action">
<!ENTITY % action.space.class "action.space">
<!ENTITY % split.class	   "split">
<!ENTITY % box.glue.class  "box.glue">
<!ENTITY % box.area.class  "box.area">
<!ENTITY % slider.class    "slider">

<!ENTITY % layout.flow.class "layout.flow">
<!ENTITY % layout.box.class  "layout.box">
<!ENTITY % layout.grid.class  "layout.grid">
<!ENTITY % layout.border.class  "layout.border">

<!-- Entities for mixtures of standalone elements -->

<!ENTITY % panel.child.mix
 "%component.class;|%tab.pane.class;|%panel.class;
 |%scroll.class;|%split.class;
 |%box.glue.class;|%box.area.class;|%slider.class;">

<!ENTITY % tab.pane.child.mix
 "%panel.class;">

<!ENTITY % scroll.child.mix
 "%component.class;|%panel.class;">

<!ENTITY % toolbar.child.mix
 "%action.class;|%component.class;|%action.space.class;">

<!ENTITY % split.child.mix
 "%component.class;|%panel.class;|%scroll.class;">

<!ENTITY % layout.mix "%layout.flow.class;
    |%layout.box.class;|%layout.grid.class;
    |%layout.border.class;">

<!-- Entities for customizable content models -->

<!ENTITY % size.mdl
        "preferred?,max?,min?">

<!ENTITY % border.mdl
        "insets?">

<!ENTITY % dimension.mdl
        "dimension">

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

<!ENTITY % tab.pane.mdl
        "size?,border?,tab.pane.child+">

<!ENTITY % component.mdl
        "size?,border?">

<!ENTITY % scroll.mdl
        "size?,border?,scroll.child">

<!ENTITY % toolbar.mdl
        "size?,border?,insets?,toolbar.child+">

<!ENTITY % action.mdl
        "size?,border?">

<!ENTITY % action.space.mdl
        "dimension?">

<!ENTITY % split.mdl
        "size?,border?,split.child,split.child">

<!ENTITY % box.area.mdl
        "dimension">

<!ENTITY % slider.mdl
        "size?,border?">

<!-- Entities for common attributes -->

<!ENTITY % class.name.att
         'class.name
	 CDATA
         #REQUIRED'>

<!ENTITY % value.name.att
         'value.name
	 CDATA
         #REQUIRED'>

<!ENTITY % panel.name.att
         'panel.name
	 CDATA
         #IMPLIED'>

<!ENTITY % layout.box.direction.att
         'layout.box.direction
         (X_AXIS|Y_AXIS)
         #REQUIRED'>

<!ENTITY % layout.flow.direction.att
         'layout.flow.direction
         (CENTER|LEADING|LEFT|RIGHT|TRAILING)
         #REQUIRED'>

<!ENTITY % layout.grid.numrows.att
         'layout.grid.numrows
	 CDATA
         #REQUIRED'>

<!ENTITY % layout.grid.numcols.att
         'layout.grid.numcols
	 CDATA
         #REQUIRED'>

<!ENTITY % layout.grid.hgap.att
         'layout.grid.hgap
	 CDATA
         #IMPLIED'>

<!ENTITY % layout.grid.wgap.att
         'layout.grid.wgap
	 CDATA
         #IMPLIED'>

<!ENTITY % layout.border.hgap.att
         'layout.border.hgap
	 CDATA
         #IMPLIED'>

<!ENTITY % layout.border.wgap.att
         'layout.border.wgap
	 CDATA
         #IMPLIED'>

<!ENTITY % layout.border.constraint.att
         'layout.border.constraint
	 (CENTER|EAST|WEST|SOUTH|NORTH)
         #IMPLIED'>

<!ENTITY % toolbar.direction.att
         'toolbar.direction
         (horizontal|vertical)
         #IMPLIED'>

<!ENTITY % toolbar.float.att
         'toolbar.float
         (true|false)
         #IMPLIED'>

<!ENTITY % toolbar.layout.border.constraint.att
         'toolbar.layout.border.constraint
	 (EAST|WEST|SOUTH|NORTH)
         #REQUIRED'>

<!ENTITY % insets.top.att
         'insets.top
         CDATA
         #REQUIRED'>

<!ENTITY % insets.left.att
         'insets.left
         CDATA
         #REQUIRED'>

<!ENTITY % insets.bottom.att
         'insets.bottom
         CDATA
         #REQUIRED'>

<!ENTITY % insets.right.att
         'insets.right
         CDATA
         #REQUIRED'>

<!ENTITY % split.direction.att
         'split.direction
         (horizontal|vertical)
         #IMPLIED'>

<!ENTITY % split.continuous.att
         'split.continuous
         (true|false)
         #IMPLIED'>

<!ENTITY % split.div.loc.att
         'split.div.loc
         CDATA
         #IMPLIED'>

<!ENTITY % split.div.size.att
         'split.div.size
         CDATA
         #IMPLIED'>

<!ENTITY % split.quickexp.att
         'split.quickexp
         (true|false)
         #IMPLIED'>

<!ENTITY % box.glue.direction.att
         'box.glue.direction
         (horizontal|vertical)
         #REQUIRED'>

<!ENTITY % alignmentX.att
         'alignmentX
	 (CENTER|LEFT|RIGHT)
         #IMPLIED'>

<!ENTITY % alignmentY.att
         'alignmentY
	 (CENTER|TOP|BOTTOM)
         #IMPLIED'>

<!ENTITY % dimensionX.att
         'dimensionX
         CDATA
         #REQUIRED'>

<!ENTITY % dimensionY.att
         'dimensionY
         CDATA
         #REQUIRED'>

<!ENTITY % border.att
         'border
	 (RAISED|LOWERED|ETCHED|TITLED)
         #REQUIRED'>

<!ENTITY % border.title.att
         'border.title
	 CDATA
         #IMPLIED'>

<!ENTITY % label.text.att
         'label.text
	 CDATA
         #IMPLIED'>

<!ENTITY % label.image.att
         'label.image
	 CDATA
         #IMPLIED'>

<!ENTITY % access.imagedescript.att
         'access.imagedescript
	 CDATA
         #IMPLIED'>

<!ENTITY % action.command.att
         'action.command
	 CDATA
         #IMPLIED'>

<!ENTITY % font.name.att
         'font.name
	 (Serif|Sans-serif|Monospaced|Dialog|DialogInput)
         #IMPLIED'>

<!ENTITY % font.style.att
         'font.style
	 (PLAIN|BOLD|ITALIC|BOLDITALIC)
         #IMPLIED'>

<!ENTITY % font.size.att
         'font.size
	 CDATA
         #IMPLIED'>

<!ENTITY % color.fg.att
         'color.fg
	 CDATA
         #IMPLIED'>

<!ENTITY % color.bg.att
         'color.bg
	 CDATA
         #IMPLIED'>

<!ENTITY % access.name.att
         'access.name
	 CDATA
         #IMPLIED'>

<!ENTITY % access.descript.att
         'access.descript
	 CDATA
         #IMPLIED'>

<!ENTITY % component.tooltip.att
         'component.tooltip
	 CDATA
         #IMPLIED'>

<!ENTITY % h.alignment.att
         'h.alignment
	 (CENTER|LEFT|RIGHT|LEADING|TRAILING)
         #IMPLIED'>

<!ENTITY % h.text.position.att
         'h.text.position
	 (CENTER|LEFT|RIGHT|LEADING|TRAILING)
         #IMPLIED'>

<!ENTITY % v.alignment.att
         'v.alignment
	 (CENTER|TOP|BOTTOM)
         #IMPLIED'>

<!ENTITY % v.text.position.att
         'v.text.position
	 (CENTER|TOP|BOTTOM)
         #IMPLIED'>

<!ENTITY % icon.text.gap.att
         'icon.text.gap
	 CDATA
         #IMPLIED'>

<!ENTITY % scroll.h.block.increment.att
         'scroll.h.block.increment
         CDATA
         #IMPLIED'>

<!ENTITY % scroll.h.unit.increment.att
         'scroll.h.unit.increment
         CDATA
         #IMPLIED'>

<!ENTITY % scroll.v.block.increment.att
         'scroll.v.block.increment
         CDATA
         #IMPLIED'>

<!ENTITY % scroll.v.unit.increment.att
         'scroll.v.unit.increment
         CDATA
         #IMPLIED'>

<!ENTITY % wordwrap.att
         'wordwrap
         (true|false)
         #IMPLIED'>

<!ENTITY % editable.att
         'editable
         (true|false)
         #IMPLIED'>

<!ENTITY % opaque.att
         'opaque
         (true|false)
         #IMPLIED'>

<!ENTITY % slider.direction.att
         'slider.direction
         (horizontal|vertical)
         #IMPLIED'>

<!ENTITY % slider.invert.att
         'slider.invert
         (true|false)
         #IMPLIED'>

<!ENTITY % slider.from.att
         'slider.from
         CDATA
         #IMPLIED'>

<!ENTITY % slider.to.att
         'slider.to
         CDATA
         #IMPLIED'>

<!ENTITY % slider.init.att
         'slider.init
         CDATA
         #IMPLIED'>

<!ENTITY % slider.min_tick.att
         'slider.min_tick
         CDATA
         #IMPLIED'>

<!ENTITY % slider.maj_tick.att
         'slider.maj_tick
         CDATA
         #IMPLIED'>

<!-- End of Entities -->

<!-- Start of Elements -->

<!ELEMENT panel.child (%panel.child.mix;)>
<!ELEMENT tab.pane.child (%tab.pane.child.mix;)>
<!ELEMENT scroll.child (%scroll.child.mix;)>
<!ELEMENT toolbar.child (%toolbar.child.mix;)>
<!ELEMENT split.child (%split.child.mix;)>

<!ELEMENT size (%size.mdl;)>

<!ELEMENT preferred (%dimension.mdl;)>
<!ELEMENT max (%dimension.mdl;)>
<!ELEMENT min (%dimension.mdl;)>

<!ELEMENT dimension EMPTY>
<!ATTLIST dimension
          %dimensionY.att;
          %dimensionX.att;>

<!ELEMENT layout (%layout.mix;)>

<!ELEMENT layout.box EMPTY>
<!ATTLIST layout.box
          %layout.box.direction.att;>

<!ELEMENT layout.flow EMPTY>
<!ATTLIST layout.flow
          %layout.flow.direction.att;>

<!ELEMENT layout.grid EMPTY>
<!ATTLIST layout.grid
	  %layout.grid.numrows.att;
          %layout.grid.numcols.att;
	  %layout.grid.hgap.att;
          %layout.grid.wgap.att;>

<!ELEMENT layout.border EMPTY>
<!ATTLIST layout.border
	  %layout.border.hgap.att;
          %layout.border.wgap.att;>

<!ELEMENT border (%border.mdl;)>
<!ATTLIST border
          %border.att;
          %border.title.att;>

<!ELEMENT insets EMPTY>
<!ATTLIST insets
          %insets.top.att;
          %insets.left.att;
          %insets.bottom.att;
          %insets.right.att;>

<!ELEMENT component (%component.mdl;)>
<!ATTLIST component
          %opaque.att;
	  %wordwrap.att;
	  %editable.att;
          %class.name.att;
          %value.name.att;
          %label.text.att;
	  %label.image.att;
	  %access.imagedescript.att;
	  %action.command.att;
	  %font.name.att;
	  %font.style.att;
	  %font.size.att;
	  %alignmentX.att;
	  %alignmentY.att;
	  %layout.border.constraint.att;
	  %access.name.att;
	  %access.descript.att;
	  %component.tooltip.att;
	  %color.fg.att;
	  %color.bg.att;
	  %h.alignment.att;
	  %h.text.position.att;
	  %v.alignment.att;
	  %v.text.position.att;
	  %icon.text.gap.att;>

<!ELEMENT box.glue EMPTY>
<!ATTLIST box.glue
          %box.glue.direction.att;>

<!ELEMENT box.area (%box.area.mdl;)>

<!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;>

<!ELEMENT tab.pane (%tab.pane.mdl;)>
<!ATTLIST tab.pane
          %opaque.att;
	  %font.name.att;
	  %font.style.att;
	  %font.size.att;
	  %alignmentX.att;
	  %alignmentY.att;
	  %layout.border.constraint.att;
	  %access.name.att;
	  %access.descript.att;
	  %color.fg.att;
	  %color.bg.att;>

<!ELEMENT toolbar (%toolbar.mdl;)>
<!ATTLIST toolbar
          %opaque.att;
          %toolbar.direction.att;
	  %toolbar.float.att;
	  %toolbar.layout.border.constraint.att;
	  %access.name.att;
	  %access.descript.att;
	  %color.fg.att;
	  %color.bg.att;>

<!ELEMENT action (%action.mdl;)>
<!ATTLIST action
          %opaque.att;
          %value.name.att;
          %label.text.att;
	  %label.image.att;
	  %action.command.att;
	  %font.name.att;
	  %font.style.att;
	  %font.size.att;
	  %alignmentX.att;
	  %alignmentY.att;
	  %access.name.att;
	  %access.descript.att;
	  %component.tooltip.att;
	  %color.fg.att;
	  %color.bg.att;
	  %h.alignment.att;
	  %h.text.position.att;
	  %v.alignment.att;
	  %v.text.position.att;
	  %icon.text.gap.att;>

<!ELEMENT action.space (%action.space.mdl;)>

<!ELEMENT split (%split.mdl;)>
<!ATTLIST split
          %opaque.att;
          %split.direction.att;
	  %split.continuous.att;
	  %split.div.loc.att;
	  %split.div.size.att;
	  %split.quickexp.att;
	  %alignmentX.att;
	  %alignmentY.att;
	  %layout.border.constraint.att;
	  %access.name.att;
	  %access.descript.att;
	  %color.fg.att;
	  %color.bg.att;>

<!ELEMENT scroll (%scroll.mdl;)>
<!ATTLIST scroll
          %opaque.att;
          %value.name.att;
	  %scroll.h.block.increment.att;
	  %scroll.h.unit.increment.att;
	  %scroll.v.block.increment.att;
	  %scroll.v.unit.increment.att;
	  %alignmentX.att;
	  %alignmentY.att;
	  %layout.border.constraint.att;
	  %access.name.att;
	  %access.descript.att;
	  %color.fg.att;
	  %color.bg.att;>

<!ELEMENT slider (%slider.mdl;)>
<!ATTLIST slider
          %opaque.att;
          %value.name.att;
	  %alignmentX.att;
	  %alignmentY.att;
	  %layout.border.constraint.att;
	  %access.name.att;
	  %access.descript.att;
	  %component.tooltip.att;
	  %color.fg.att;
	  %color.bg.att;
	  %slider.direction.att;
	  %slider.invert.att;
	  %slider.from.att;
	  %slider.to.att;
	  %slider.init.att;
	  %slider.min_tick.att;
	  %slider.maj_tick.att;>

<!-- End of Element -->




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.