Making a User-Defined Class

You can make classes out of almost any java.awt.class; from a stylized button to a panel containing panels containing other objects. You cannot make a class from the top level container (the applet or frame).

  1. Create the object or group of objects modifying them as necessary.

  2. Handle events as follows:

  3. Select the object or panel of objects.

    If you select a panel, you include all of its contained objects.

  4. Choose File > Make Class...

  5. In the resulting dialog, specify the class name* and click OK.

    Three things happen:

    *A legal class name begins with a letter, _, or $ that is followed by any alphanumeric character, _, or $.

  6. If the class files (.vb, .java, .class, and .palette) were created in a directory other than the project directory, move them into the project directory.

  7. Add class_name.java to your project.

The class is now on the <Local> palette and can be instantiated in your workarea. Notice also that a popup label with your class name appears when the cursor is held over the icon, and quick help appears in the lower-left area of the visual builder window.

Each class you make generates a .class, .java, .vb, and .palette file.

See Also

Guide to the Cosmo Code Development Environment
12-96*518