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.
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.
This document introduces the Cocoa application environment using the Java language and teaches you how to leverage Apple’s development tools to build robust, object-oriented applications. Cocoa provides the best way to build modern, multimedia-rich, object-oriented applications for consumers and enterprise customers alike. This document assumes you are familiar with Java programming but does not assume you have previous experience with Cocoa or Xcode Tools.
This document is intended for Java programmers interested in developing Cocoa applications. Keep in mind, however, that Java is not Cocoa’s native language. To develop Cocoa applications that you intend to release to end users, you must use Objective-C. No Java interfaces for new Cocoa features will be added to Mac OS X versions after 10.4. Therefore, features added to Cocoa in subsequent versions Mac OS X will not be available to Cocoa applications developed using Java.
This document shows how to build Currency Converter, an application that converts a dollar amount to an amount in another currency, given the rate of that currency relative to the dollar. The main window of the finished application is shown in Figure I-1.
Currency Converter is a simple application, yet it exemplifies much of what software development with Cocoa is all about. As you’ll discover, Currency Converter is amazingly easy to create, and it’s equally amazing how many features you get “for free”—as with all Cocoa applications.
This document leads you through the basic steps for creating a Cocoa application. It shows how to:
Create an Xcode project
Create a graphical user interface using Interface Builder
Create a custom subclass of a Cocoa framework class
Connect an instance of your custom subclass to the user interface
Build an application and correct problems
By following the instructions provided in this document, you familiarize yourself with the two most important applications used for developing Mac OS X applications: Interface Builder and Xcode. You also learn the typical workflow of Cocoa application development:
Designing the application (your brain)
Creating the project (Xcode)
Creating the user interface (Interface Builder)
Defining the classes that implement the application’s functionality (Interface Builder)
Implementing the application’s functionality (Xcode)
Building the application (Xcode)
Running and testing the application (Xcode)
Organization of This Document
See Also
This document consists of the following chapters:
Creating the Currency Converter Project and User Interface guides you through the development of the Currency Converter user interface.
Implementing Currency Converter shows how to define the custom behavior of the application.
Building Currency Converter explains how to build the application.
Expanding on the Basics explains some of the behavior Cocoa applications get by default.
Adopting Objective-C lists the basic steps Java developers need to perform to adopt Objective-C.
This document also contains a revision history.
These documents provide detailed information on Cocoa development:
Cocoa Fundamentals Guide describes the Cocoa application environment.
Getting Started with Cocoa provides a road map for learning Cocoa.
The Objective-C 2.0 Programming Language introduces Objective-C and describes the Objective-C runtime system, which leads to much of Cocoa’s dynamic behavior and extensibility.
Apple Human Interface Guidelines explain how to lay out user interface elements to provide a pleasant user experience.
© 2002, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-10-03)