BeeSoft®
Since 1992
 

Content

 Welcome
 Products
       Abeona
       Gaia
             News
             Documentation
                   Introduction
                   Swing support
                         Components
                               JCalendar
                               Lazy tree loading
                               JTreeTable
                               Simple form
                               Form
                         Building from XML
                         Client / server
                   Server application
                   Validation
                   XML
                   Logging
                   Utilities
                   Launcher
             License
             Download
       Hephaistos
       JavaGantt
 Services
       Promote your software
 Contact Us
 Links
      
  GaiaI®
© 2012 BeeSoft ®
 

SimpleSwingForm

SimpleSwingForm is a component designed to the simplification of building the Swing forms.

  • it uses GridBagLayout to layout the components
  • it layouts components automatically, each component on the new row, but you can change this behavior by overriding methods customizeLabelConstraints(GridBagConstraints, JLabel) and customizeComponentConstraints(GridBagConstraints, JComponent)
  • the most simple is building of the two-columns form, where are labels in the first column
  • component offers a lot of the showDialog(...) methods to show this form in a dialog
  • if you subclasses this component, you can use standard OK action and serve it in okActionPerformed() method without writting any action

Here is a simple example of SimpleSwingForm usage:


	SimpleSwingForm form = new SimpleSwingForm ();
	form.addLabeledComponent ("Label 1", form.createTextField ());
	form.addLabeledComponent ("Label 2", new JTextArea ());
	Action okAction = new MyOkAction (); // you must do something on OK
	form.showDialog ("My form", okAction, form.createStandardCancelAction ());

This builds on the 5 lines of code a two-rows form with labels "Label 1" and "Label 2" in the first column and components text field and text area in the second. Then is the form displayed in a dialog.