JFormDesigner Examples README
Introduction
This folder contains example source code and forms.
To try this examples, create a new IDE project in this folder and
add src
to the source folders of the project. Because
some of the examples require jfd-annotations.jar
, jfd-loader.jar
or beansbinding.jar
, add them to the build path of the
project. You'll find the libraries in the JFormDesigner's redist
folder.
Package com.jformdesigner.examples.basic
- CodeGenExample.java/.jfd: Demonstrates the use of the
JFormDesigner generated code.
Run the main()
method of this file
to test this example.
- LoaderExample.java/.jfd: Demonstrates the use of the
JFormDesigner form
loader API. Requires
jfd-loader.jar
to load forms at
runtime.
Run the main()
method of this file
to test this example.
Package com.jformdesigner.examples.beans
Some custom components that demonstrate use of JFormDesigner
Annotations and implementation of BeanInfo
classes that use JFormDesigner BeanDescriptor
and PropertyDescriptor
Attributes.
- ContainerDelegateDemoPanel.java: A panel that demonstrates
the use of container delegates. It has own components and a content
pane, where you can add more components in JFormDesigner. To test this
panel, create a form and use "Choose Bean" to add this panel to the
form. You'll see the components of this panel and can add additional
components (in JFormDesigner) to the content pane.
- JBackgroundImagePanel.java: A panel that paints an image
on the background. Demonstrates the use of JFormDesigner
Annotations.
- JGradientPanel.java: A panel that paints a gradient
background from "background" color to "background2" color using the
specified direction and magnitude. Demonstrates the use of JFormDesigner
Annotations.
- JGradientPanelBIC.java: This class is equal to
JGradientPanel
but uses a traditional BeanInfo class (BIC) JGradientPanelBICBeanInfo.java
instead of annotations. Demonstrates the implementation of a BeanInfo
class that uses JFormDesigner BeanDescriptor
and PropertyDescriptor
Attributes.
- JBaseDialog.java/.jfd: A base dialog that can be used as
superclass for own dialogs. It includes a button bar (OK, Cancel and
Help), adds a listener for the ESC key that closes the dialog and
handles closing from window manager (e.g. 'x' in window title).
- MyDialog.java/.jfd: Demonstrates the use of
JBaseDialog
.
Run the main()
method of this file
to test this example.
Package com.jformdesigner.examples.beansbinding.clienteditor
An example, ported from NetBeans to JFormDesigner, for using Beans
Binding (JSR 295). Uses binding converters
and validators.
- AgeConverter.java:
Integer
to String
converter that returns zero when the argument cannot be parsed.
- AgeValidator.java: Validator that ensures that given value
is between 1 and 199.
- Client.java: Information about one client.
- ClientEditor.java/.jfd: Form that allows editing of
information about one client.
Run the main()
method of this file
to test this example.
- EmailValidator.java: Validator that ensures that given
string is an e-mail address.
- LoggingBindingListener.java: Binding listener used to log
synchronization events. It displays (in given label) warnings for
failed synchronizations.
- MaritalStatusConverter.java: Converter between marital
status code and its human-readable representation.
- RequiredStringValidator.java: Validator that ensures that
given string is not empty.
Package com.jformdesigner.examples.beansbinding.simple
A simple example for using Beans
Binding (JSR 295).
- SimpleBindingDemo.java/.jfd: This is a very basic example
of
using Beans
Binding (JSR 295) to bind GUI components to a data object. The
components "Value 1" and "Value 2" are bound to "simpleData" object
fields. The components "Copy of Value 1" and "Copy of Value 2" are also
bound to "simpleData". Initially, the values of "simpleData" are copied
to the GUI components. Changes in the GUI components are copied back to
"simpleData", which fires events to inform others. So if you change
"Value 1", the value is copied to "simpleData.value1" and then copied
to "Copy of Value 1".
Run the main()
method of this file
to test this example.
- SimpleData.java: Demo data model class used in
SimpleBindingDemo.java/.jfd
.
Package com.jformdesigner.examples.beansbinding.taskmanager
Advanced example for using Beans
Binding (JSR 295).
- TaskView.java/.jfd: This view shows/edits a single
task.
It uses Beans
Binding to bind the properties of
task
to input
fields. Beans Binding is also used to enable/disable the input fields.
Run the main()
method of this file
to test this example.
- TasksView.java/.jfd: This view shows a list of tasks in a
JTable
and provides New, Edit and Delete buttons to edit the tasks. It uses Beans
Binding to bind the list of tasks
to the JTable
.
Beans Binding is also used to enable/disable the Edit and Delete
buttons based on selection. The New and Edit buttons use class TaskView
to show/edit the selected task in a sub-dialog.
Run the main()
method of this file
to test this example.
- TasksEmbeddedView.java/.jfd: This view shows a list of
tasks
in a
JTable
, the selected task in an embedded TaskView
and provides New and Delete buttons to edit the tasks. It uses Beans
Binding to bind the list of tasks
to the JTable
and the selected task to the embedded TaskView
. Beans
Binding is also used to enable/disable the Delete button based on
selection. The New button uses TaskView
to edit a new
task in a sub-dialog.
Run the main()
method of this file
to test this example.
- Task.java: Task data model class. It has getter and setter
methods to access property values and supports property change
listeners thru class
AbstractModelObject
.
Package com.jformdesigner.examples.formmodel
Examples for using JFormDesigner
Runtime Library to dynamically create JFormDesigner forms (*.jfd).
All examples in this package require jfd-loader.jar
.
- CreateFormLayoutFormExample.java: Demonstrates how to use
the JFormDesigner form model API and form saver API to dynamically
create a form file from a list of properties using FormLayout.
Run the main()
method of this file
to test this example.
- CreateGridBagLayoutFormExample.java: Demonstrates how to
use the JFormDesigner form model API and form saver API to dynamically
create a form file from a list of properties using GridBagLayout.
Run the main()
method of this file
to test this example.
- DumpFormFile.java: Loads JFormDesigner form files (*.jfd)
and dumps the content. Demonstrates the use of the JFormDesigner form
loader API.
Run the main()
method of this file
to test this example.
- FormSaverExamples.java: Demonstrates how to use the
JFormDesigner form model API and form saver API to create form files
using various layout managers. It creates in-memory form models and
saves them to .jfd files.
Run the main()
method of this file
to test this example.
Package com.jformdesigner.examples.propertyeditors
Examples for implementing property editors for complex property
values. Property editors are used in the JFormDesigner Properties
view.
- MyImmutablePropertyData.java: This is a immutable custom
type used as property values. Immutable means that it has no methods to
modify its value.
- MyImmutablePropertyDataEditor.java: Property editor for
MyImmutablePropertyData
.
This property editor demonstrates how to build a custom editor and how
to update the property values on changes.
- MyPropertyData.java: This is a (mutable) custom type used
as property values. Mutable means that it has setter methods to modify
its value.
- MyPropertyDataEditor.java: Property editor for
MyPropertyData
.
This property editor demonstrates how to build a custom editor and how
to update the property values on changes.
- PropertyEditorTestBean.java: This is a (non-visual) bean
to test the property editors. It uses
MyPropertyData
and MyImmutablePropertyData
.
Use "Choose Bean" in JFormDesigner to add it to a form.
- PropertyEditorTestForm.java/.jfd: Test form for property
editors.
Copyright © 2004-2011 FormDev Software GmbH. All rights
reserved.