Editing a Java Form
To edit a Java Form, the Java Form Designer can be used to perform the following operations:
Setting Beans
From the object palette, select and lay out the Beans and then set the attributes.
Defining an exclusive selection group
Select [Tools] > [Button Groups] from the Java Form Designer menu bar.
Decorating a Java Form
Draw elements such as lines and squares to decorate the Java Form.
Screen configuration of the Java Form Designer
The Java Form Designer screens are made up of the following five windows, editors, and views. Use these screens to edit Java Forms:
Java Form Designer window
Allows a Java Form to be saved and provides editing functionality, such as copying a Bean
Properties window
Displays a list of Beans and allows properties to be viewed and modified
Java Form window
Allows beans to be positioned on a Java Form and the layout edited
Java editor
Allows event processing and user-defined methods for Beans to be described
Bean List view
Displays a list of Beans and allows methods and events to be inserted
Note
If the Java editor has been used to open a Java Form, sections of the source displayed with a different background color cannot be edited. The source in these sections invokes screen (Bean) information or event processing. Modification is also prohibited for "// Graphical Editor Form" at the beginning and for the part enclosed within "//@@Form Design Information start" and "//@@Form Design Information end". Once these parts are edited, they cannot be opened by the Graphical Editor.
Use a mouse to perform operations such as laying out a new Bean, modifying the size, shifting, and copying.
Laying out a new Bean
Allows a new Bean to be easily dragged and dropped from the Java Form Designer
Laying out a new Bean
Allows a new Bean to be easily dragged and dropped from the Java Form Designer
The layout manager is provided as a method of laying out a Bean using a Java application. When the layout manager is used, the layout will be corrected automatically according to the modifications made to the screen size but will be subject to the constraints of the screen formats supported by the layout manager.
From the viewpoint of screen extendibility, handling modifications made to the screen size is desirable, so using the layout manager in the screen design of Java applications is recommended.
Layout characteristics
FlowLayout
Lays out Beans horizontally
BorderLayout
Lays out Beans from top to bottom, left to right
GridLayout
Lays out Beans in a grid with equal vertical and horizontal sizes
GridBagLayout
Lays out Beans in a grid in the same way as GridLayout, but allows detailed setting of sizing rules
CardLayout
Used for switching panels
Point
If Bean drawings overlap, a Heavyweight will be drawn over a Lightweight. In addition, if the drawings overlap among components, they will be determined according to the order in which the components were added to a container. The order in which they were added is their order on the component tree. If the layout manager specification is other than "none", there will be no overlapping among drawings within the same component.
Bean properties can be classified into the following types:
Standard Properties
Original Properties
List of Standard Properties
Standard Properties are typical properties of a Java Form or Bean. The list of Standard Properties is as follows:
Property |
---|
beanName |
layout |
bounds |
border |
constraints |
addIndex |
visible |
background |
foreground |
font |
AWTName |
toolTipText |
attention |
Note
The bounds property displays the values of the width and height of the client area of a window, but the values of the width and height of the window itself will be displayed if [Edit as Execution Image] has been selected.
Original Properties
Original Properties are displayed based on information that has been specified in the BeanInfo information provided by various Beans.
If a Original Properties is a read-only property, a write-only property, or an invisible property, it will not be displayed.
In addition, some properties will not be displayed if [Show expert property] has not been selected in the properties of the Environment Setup options.
Note
For projects in which the Peculiar Property name begins with an asterisk (*), the initial value of [Value] cannot be changed.
Information in the properties sheet
The properties sheet of the properties window is used to reference or set properties. The following information will be displayed in the properties sheet:
Standard tab
Displays the Standard Properties of a Bean
Original tab
Displays the Peculiar Properties of a Bean
Property Name
Displays the names of the properties
Value
Displays the values of the properties being set. When these values are rewritten, the properties of a Bean can be modified. Depending on the property type, values are selected either from a list or by selecting a numeric value using a spin button.
Description
Descriptions of the selected properties are displayed in the lower part of the properties sheet
Functions of the properties sheet
The buttons in the properties window have the following functions:
Show Customizer
If the Beans being selected are being provided by the Customizer, displays the Customizer
Select from the list
If the properties being selected are being provided by the properties editor, displays the properties editor
Sett null value
Sets nulls in the properties being selected. These can be set for properties that are not basic data types in Java.
Reset the value
Reverts the values of the properties to the standard values
Undo
Reverts the values of the properties to the status they had before the last modification
Point
The Java Form Designer has a function for editing the main properties of a Bean on a form, which is referred to as the spot edit function. To use the spot function, from the Java Form Designer menu bar, go to [Settings] > [Options] > [Form] tab and then select [Enable spot editing].
When you click on the Bean being selected or when you press the [Ctrl+E] keys simultaneously, the spot edit status will result, and a label indicating that spot editing is in progress will be displayed in the upper part of the Bean.
To end the spot edit, press the [Enter] key, or for a spot edit that allows multiple line input, press the [Ctrl+Enter] keys.
The Java Form Designer allows Bean Relationships to be created in an interactive format in Java Forms, applets, and Java programs and allows these Bean Relationships to be visualized.
Creating Bean Relationships
[Bean Relationships Wizard] can be launched using the method shown below. When you follow the instructions of the Wizard to set a source Bean event and a target Bean method or property, a Bean Relationships source will be created in the description of the event processing of the specified Bean.
Launch the menu.
Select [Tools] > [Bean Relationships Wizard] from the Java Form Designer menu bar.
Launch wiring.
Right-click the Bean that is to perform event processing of the Java Form (source Bean).
While holding down the right mouse button, drag the mouse. While you are dragging, a line (wire) will be displayed from the position at which the mouse was right-clicked to the current position of the mouse cursor.
While still holding down the mouse button, move the mouse and then release the right mouse button on the Bean that is to invoke a method, obtain a property, or set a property (target Bean).
Editing Bean Relationships
When you edit the values that have been specified in [Bean Relationships Wizard] and click [Create], the Bean Relationship source will be updated in the description of the event processing that corresponds to the Visualized Bean Relationships (directional lines).
To start the Wizard:
Double-click the Visualized Bean Relationships (directional lines) of the Java Form.
Right-click the Visualized Bean Relationships (directional lines) of the Java Form and display the context menu. Select [Edit by Wizard].
Select [Tools] > [Check Bean Relationships] from the Java Form Designer menu bar. Select the Bean Relationships to be edited from the Bean Relationships list on the [Check Bean Relationships] screen and then click [Edit by Wizard].
Deleting Bean Relationships
Bean Relationships can be deleted by right-clicking the Visualized Bean Relationships (directional lines) of the Java Form and clicking [Delete] from the context menu.
Point
Deleting Bean Relationships can also be performed from the Bean Relationships confirmation screen.
Displaying Bean Relationships
To confirm Bean Relationships, select [Tools] > [Check Bean Relationships] from the Java Form Designer menu bar and launch the [Check Bean Relationships] screen.
The [Check Bean Relationships] screen displays a list of all the Bean Relationships and allows the creation, edit, and deletion of Bean Relationships.
Analyzing Bean Relationships
Bean Relationships are analyzed automatically, but it is also possible to perform optional analysis by selecting [Edit] > [Re-analyze Bean Relationships] from the Java Form Designer menu bar.
Menu definition
If pull-down menus are to be used, select [Tools] > [Menus] from the Java Form Designer menu bar and launch menu definition. In menu definition, define the configuration of the menus and information such as the character strings to be displayed in the menus.
Menu definition
Menu objects that have been defined in Java Forms will become the class fields of the Java Forms. There is usually no need to use these fields to operate menus directly, but objects can be operated via class fields in order to perform special processing.
An example of operating a menu object is shown below.
Example
If an "APPLY" attention occurs, a "cancel" menu object is masked.
public boolean processAttention_APPLY() { cancel.setEnabled(false); return true; }
Attentions
Attentions are used to define the actions for menu operations. Attentions are the names given to describe the general operations of both the screens and menus. They are used to define the operation of menus, buttons, or keys.
Note
It is essential for an action event to have been defined in order for an attention to be caused, so this is no different from an ordinary action event. Therefore, as attentions may require more time and effort, their use is not recommended.
An exclusive selection group is a function that groups exclusive selection type Beans (radio buttons) and automatically sets the selection status. Only one Bean in a single exclusive selection group will have a status of selected; the other Beans will be set with an unselected status.
Method of defining an exclusive selection group
Displaying the setup dialog box of the exclusive selection group
Select [Tools] > [Button Groups] from the Java Form Designer menu bar and start defining the exclusive selection group.
Creating a new exclusive selection group
Click [Add JFButtonGroup(JBK)], [Add CheckboxGroup(AWT)], or [Add ButtonGroup(Swing)] to create a new selection group.
Setting group members
Select a created group name that from the [Groups] list and then click [Edit Member]. The [Exclusive Selection Members] screen will be displayed. Set the group members in this screen.
Note
Default exclusive selection groups (group names: __cdDefaultJFButtonGroup, __cdDefaultCheckboxGroup, and __cdDefaultButtonGroup) have been defined in advance. If an exclusive selection type Bean has been pasted onto a Java Form, it will be automatically added to the default exclusive selection groups. The default exclusive selection groups cannot be deleted.
Direct operation of exclusive selection groups
To perform special processing, objects can be operated using class fields.
[Class field name]
Name specified by "group object name" when a group has been added using the exclusive selection group definition dialog box
[Class field type]
Type of exclusive selection group that has been created | Class field type of exclusive selection group object |
---|---|
Group for AWT | java.awt.CheckboxGroup |
Group for Swing | javax.swing.ButtonGroup |
Example
If an "APPLY" attention occurs, red will be set as the background color of the object that has been exclusively selected in the "select" exclusive selection group for AWT.
public boolean processAttention_APPLY() { select.getSelectedCheckbox().setBackground(java.awt.Color.red); return true; }