Top
Interstage Studio User's Guide
FUJITSU Software

7.3.9 Describing User Interface Processing

This section explains the method of creating user interface processing. This is relevant for forms, applets, and the visible Beans of JavaBeans.

7.3.9.1 Describing Processing of an Application with a User Interface

This section explains the processing of an application that displays a frame, as an example of an application with a user interface.

The processing includes the following:

Example of main program that displays a frame

public class MyJavaApp {
    //Constructor
    public MyJavaApp() {
    }
    //Method that displays a frame
    public void run() {
        //Create a frame instance.
        Frame1 form = new Frame1();
        //Use setVisible method of the frame instance and enable display.
        form.setVisible(true);
    }
    //Main processing
    public static void main(String[] args) {
        //Create a MyJavaApp class instance.
        MyJavaApp object = new MyJavaApp();
        //Invoke a run method of the MyJavaApp class instance.
        object.run();
    }
}

7.3.9.2 Operating a Form

Forms are made up of frames, dialogs, and panels.

This section explains the description of the processing, using frames as an example.

Frame operation

This section explains frame operation as an example of operation.

7.3.9.3 Operating a Bean

This section explains how to operate a Bean.

A Bean that has been pasted into a Java Form will be generated as a class field of a Java Form class. The class field will have the name specified in the "Bean name" property when the Java Form was defined.

Bean operation is performed by setting and referencing Bean properties and invoking Bean methods.

Referencing and setting properties

An example of referencing and setting properties is shown below.

A focus_focusGained event to be generated when the text field Bean "textField1" gains focus is used to modify the background color (background) property to blue. In addition, a focus_focusLost event to be generated when focus is lost is used to return the background color (background) property to white.

[Processing of TextField1]
public void textField1_focus_focusGained(FocusEvent e) {
  if (!defaultEventProc(e)) {
    textField1.setBackground(java.awt.Color.blue);
  }
}
public void textField1_focus_focusLost(FocusEvent e) {
  if (!defaultEventProc(e)) {
    textField1.setBackground(java.awt.Color.white);
  }
}

Invoking a method

An example of invoking a method is shown below.

When the push button "button1" is pressed, the characters that have been entered in the "textField1" text field are added to the "list1" list box.

[Processing of button1]
public void button1_action_actionPerformed(ActionEvent e) {
  if (!defaultEventProc(e)) {
    list1.addItem(textField1.getText());
  }
}

7.3.9.4 Describing Event Processing

There are three methods of adding event processing: