Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Legacy Documentclose button

Important: The Java API for Cocoa is deprecated in Mac OS X version 10.4 and later. You should use the Objective-C API instead. For a tutorial on using Cocoa with Objective-C, see Cocoa Application Tutorial.

Defining the Converter Class

While connecting ConverterController’s outlets, you probably noticed that one outlet remains unconnected: converter. This outlet identifies an instance of the Converter class in the Currency Converter application, but this instance doesn’t exist yet.

The Converter implements a model object. Model objects contain special knowledge and expertise. They hold data and define the logic that manipulates that data. For example, a customer object, common in business applications, is a model object. Since instances of this type of class don’t communicate directly with the user interface, there is no need for outlets or actions. Here are the steps to be completed:

  1. In the Classes pane in the nib file window, create a subclass of java.lang.Object named “Converter”. See “Specify the ConverterController Class” for details.


    image: ../art/converter_class.gif
  2. Instantiate the Converter class. See “Create an Instance of the ConverterController Class” for details.


    image: ../art/converter_instance.gif
  3. Connect the converter outlet of the ConverterController instance to the Converter instance, as shown in Figure 1-22.


    Figure 1-22  Connecting ConverterController.converter to the Converter instance

    Figure 1-22 Connecting ConverterController.converter to the Converter instance
  4. Save the nib file.



< Previous PageNext Page > Hide TOC


Last updated: 2006-10-03




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice