Developing Java Applications: A Tutorial | Creating a Custom View Class

Connecting the View Object

The TempImageView itself has no outlets or actions, but the controller object TempController needs to communicate with it to tell it when the temperature value changes. One additional outlet in TempController is needed for this purpose.

Specify a Controller Outlet

You can always add an action or outlet to an existing custom class. Just make sure the header and implementation files of the class (if created) reflect the new outlet or action.

  1. Select the TempController class in the Classes display of the nib file window.
  2. Click the electrical-outlet icon next to the class.
  3. Choose Add Outlet from the Classes menu (or just press Return).
  4. Type the name of the outlet: "tempImage".

Before you move on the next step, be sure to collapse the listing of outlets and actions by clicking another class.

Connect the Instances

You've already created an instance of TempController; all you need to do now is connect it to the TempImageView instance through the tempImage outlet.

  1. Click the nib file window and the application window to bring them both to the front of the screen.
  2. Drag a connection from the TempController instance in the Instances display to the custom view object (TempImageView) in the application window.




  3. Select the tempImage outlet in the Connections view of the inspector and click Connect.
  4. Save the nib file.

Previous | Next
© 1998 Apple Computer, Inc.