Composing a window

Window beans are the primary visual context for other user interface components. VisualAge provides window beans from both the com.sun.java.swing and java.awt packages.

You can compose and test a window in the Visual Composition Editor. You can use window beans to create new composite beans. You can also add window beans as secondary windows. A FileDialog, which represents a system file dialog, cannot be composed as a primary window bean.


Bean Description
JDialog (Swing) or Dialog (AWT) A custom dialog, typically a secondary window
JFrame (Swing) or Frame (AWT) A desktop window with title bar, sizing borders, and sizing buttons
JInternalFrame (Swing) A frame that is a child of another Swing component
JWindow (Swing) or Window (AWT) A window without a title bar, sizing borders, and sizing buttons

Accessing a Swing window bean

Swing window beans (JDialog, JFrame, and JWindow) contain a default content pane that completely covers the base bean. With the exception of a JMenuBar, you add visual beans to the content pane. You can access the covered Swing window bean in the Beans List.

Replacing the content pane for a Swing window bean

To replace the default content pane, delete it and add another container component. When you delete the content pane, a warning appears indicating that the content pane is missing. If you save the bean without specifying a new content pane, the Visual Composition Editor adds a JPanel bean.

Arranging beans in a window

Use either of the following methods:

Basic connections

Bean--specific tasks

For examples, see the CustomerInfo class in the com.ibm.ivj.examples.vc.customerinfo package. These examples are shipped in the IBM Java Examples project.


Related procedures
Dialog and JDialog tasks
Visual bean basics
Using VisualAge beans in visual composition
Creating a class
Adding the IBM Java Examples project

Related references
Window beans
CustomerInfo sample

Dialog and JDialog tasks

Obtaining information from a closed dialog

Connect the normalResult of the show() connection to the target property for the information. Then, connect the dialog property that contains the information to the appropriate parameter of the normalResult-to-target connection.

For example, to open a dialog that prompts the user for a text field name and returns it to a label in the primary window, do the following:

  1. Connect an event in the primary window to the show() method of the dialog.
  2. Connect the normalResult of the show() connection to the text property of the label in the primary window.
  3. Connect the text property of the dialog text field to the value parameter of the normalResult-to-text connection.


Related procedures
Visual bean basics
Using VisualAge beans in visual composition
Creating a class
Adding the IBM Java Examples project

Related references
Window beans
CustomerInfo sample