PDF Ebook Cocoa Tutorial for Java Programmers

s p o n s o r e d   l i n k s

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 ac 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.

Contents
Introduction
Introduction to Cocoa Tutorial for Java Programmers

    Organization of This Document
    See Also

Chapter 1
Creating the Currency Converter Project and User Interface

    Creating the Currency Converter Project
      Open Xcode
        Choose the New Project Command
        Choose a Project Type

      Creating the Currency Converter User Interface

        What Is a Nib File?
        Open the Main Nib File
        Windows in Cocoa
        Resize the Window
        Set the Window’s Title and Other Attributes
        Set the Application Name in the Menu
        Configure a Text Field
        Duplicate an Object
        Change the Attributes of a Text Field
        Assign Labels to the Fields
        Configure a Button
        Add a Horizontal Decorative Line
        Interface Layout and Object Alignment
        Finalize the Window Layout
        Enable Tabbing Between Text Fields
        Set the First Responder for the Currency Converter Window
        Test the Interface

      Defining the ConverterController Class

        Classes and Objects
        Specify the ConverterController Class
        Paths for Object Communication: Outlets, Targets, and Actions
        Define the User Interface and Model Outlets of the ConverterController Class
        Define the Actions of the ConverterController Clas

      Interconnecting the ConverterController Class and the User Interface

        Create an Instance of the ConverterController Class
        Connect the ConverterController Class to the Text Fields
        Connect the Convert Button to the ConverterController convert Action Method

      Defining the Converter Class

Chapter 2
Implementing Currency Converter

    Generate the Source Files
    Place the Implementation Files in the Appropriate Group
    Implement the Currency Converter Classes

Chapter 3
Building Currency Converter

    Overview of the Build Process
    Build the Currency Converter Application
    Look Up Documentation
    Run Currency Converter
    Correct Build Errors
    Great Job!

Chapter 4
Expanding on the Basics

    Application and Window Behavior
    Controls and Text
    Menu Commands
    Document Management
    File Management
    Communicating With Other Applications
    Custom Drawing and Animation
    Internationalization
    Editing Support
    Printing
    Help
    Plug-in Architecture

Chapter 5

    Adopting Objective-C
    Learn the Objective-C Language
    Learn the Cocoa Class Hierarchy
    Learn Memory Management in Cocoa

Document Revision History

Download
PDF Ebook Cocoa Tutorial for Java Programmers