OOP-ResearchMake It Simpler by Object Oriented Programming

Java Swing GUI builder by XML / Example for LayoutManager of Swing GUI

Java Swing GUI builder by XML. Free Source code examples for LayoutManager of Java Swing GUI. How to use JToolBar with BorderLayout. How to align JComponents by GridLayout and BoxLayout.

This page lists the Java Swing GUI builder and free source code examples for Java Swing GUI.


PRODUCT: : Product by OOP-Research
DOC: : Documentation written by OOP-Research
PATCH: : Patch for the other vendor's system


PRODUCT:OOP XMLPanelEdit

By this Java Swing GUI builder, Java Swing GUI can be written in XML. And JFrame, JDialog or JPanel with JComponents can be generated from the XML.

XMLPanelEdit consists of:

  • Java Swing GUI builder
  • Abstract Java classes

Java Swing GUI builder included in XMLPanelEdit is the XML editor, by which you can write the JFC Swing GUI in XML.


XML editor
View Full image

By this XML editor, you can easily define the nested structure of your Java Swing GUI in XML. JPanel on JFrame or JDialog can have any LayoutManager, i.e. FlowLayout, BorderLayout, BoxLayout and GridLayout. By LayoutManager, anywhere you like within JFrame or JDialog, you can place JButton, JCheckBox, JRadioButton, JLable, JTextField, JSlider or any other JComponents.
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 LayoutManager, floatable 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 ready for internationalization (i18n).

The abstract Java classes in XMLPanelEdit represent JFrame, JDialog and JPanel. These Java classes parse the XML written by Swing GUI builder and generate your Java Swing GUI at runtime. 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.



Go Site Map Read More

DOC:Java Swing GUI example 1 : JToolBar on BorderLayout

This Java Swing example shows JToolBar with Actions on BorderLayout. The Action on JToolBar can be embed into JMenuItem on JMenu. And both of JButton on JToolBar and JMenuItem on JMenu can be toggled at the same time.

In this Java Swing GUI example, we will build some very simple text editor. When the user modifies the text on JTextArea, JButton for saving the file should be activated. And we'd like to place this interactive JButton both on JToolBar and JMenuItem.

To make it possible, we will allocate the same Action to JToolBar and JMenuItem. By enabling and disabling the single Action instance, JButton on JToolBar and its corresponding JMenuItem can be toggled at the same time. JToolBar should be placed on JPanel with BorderLayout. And to be notified of the modification in JTextArea, DocumentListener should be added into Document of the JTextArea.

This Java Swing example also shows the internationalization (i18n) of JFC Swing GUI by ResourceBundle read from the property resource file.



Go Site Map Read More

DOC:Java Swing GUI example 2 : JApplet

Java Swing example for JApplet by Java Swing GUI Tool. Floatable JToolBar can be placed on BorderLayout with Action. The JMenuItems on JMenu are enabled/disabled along with JButtons on JToolBar.
For example, when the user modifies the text on JTextArea, JButton for saving the file should be activated on JToolBar. At the same time, the JMenuItem for saving the file will also be activated in JMenu. To be notified of the modification in JTextArea, DocumentListener should be added into Document of the JTextArea.

This example uses XMLPanelEdit. 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 JFC Swing GUI in XML.



Go Site Map Read More

DOC:Java Swing GUI example 3 : GridLayout and BoxLayout

The typical Java Swing GUI has a series of JTextField along with their corresponding JLabel. By GridLayout and BoxLayout, you can place these pairs of JTextField and JLabel aligned gracefully. This example shows how to use GridLayout and BoxLayout.

This example uses XMLPanelEdit. 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, by which you can define the nested structure of your Java Swing GUI in XML. By this XML editor, you can specify any LayoutManager on JPanel, JFrame or JDialog, i.e. you can select FlowLayout, BorderLayout, BoxLayout or GridLayout.



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.