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.

Creating the Currency Converter Project

Every Cocoa application starts life as a project. A project is a repository for all the elements that go into the application, such as source code files, frameworks, libraries, the application’s user interface, sounds, and images. You use the Xcode application to create and manage your project.

The following sections cover the steps necessary to create the Currency Converter project.

In this section:

Open Xcode
Choose the New Project Command
Choose a Project Type


Open Xcode

To open Xcode:

  1. In the Finder, go to /Developer/Applications.

  2. Double-click the icon, shown in Figure 1-1.


Figure 1-1  The Xcode application icon

Figure 1-1 The Xcode application icon

The first time you start Xcode, it asks you a few setup questions. The default values should work for the majority of users.

Choose the New Project Command

When Xcode is launched, only its menu bar appears. To create a project, choose New Project from the File menu. The New Project Assistant appears.

Choose a Project Type

Xcode can build several types of applications, including everything from Carbon and Cocoa applications to Mac OS X kernel extensions and Mac OS X frameworks. For this tutorial, select Cocoa-Java Application and click Next, as shown in Figure 1-2.


Figure 1-2  Xcode New Project Assistant

Figure 1-2 Xcode New Project Assistant

  1. Type Currency Converter in the Project Name field, as shown in Figure 1-3.


    Figure 1-3  Entering a project’s name and choosing its location in Xcode New Project Assistant

    Figure 1-3 Entering a project’s name and choosing its location in Xcode New Project Assistant
  2. Click Choose to navigate to the directory where you want your project to be stored. The drop-down menu next to the Project Directory text field eventually fills up with your frequently used directories. Use this to save time in the future.

  3. Click Finish.

When you click Finish, Xcode creates the project’s files and displays the project window, shown in Figure 1-4.


Figure 1-4  The new Currency Converter project in Xcode

Figure 1-4 The new Currency Converter project in Xcode

The Groups & Files list is comprised of all the source files, images, and other resources that make up a project. These files are grouped in the project group, the first item in the Groups & Files list; this group is named after the project. The project’s files are grouped into subgroups, such as Classes, Other Sources, Resources, and so on, as shown in Figure 1-4. These groups are very flexible in that they do not necessarily reflect either the on-disk layout of the project or the way the build system handles it. They are purely for organizing your project. The groups created by Xcode should be suitable for most developers, but you can rearrange them however you like.

These are the groups Xcode sets up for Cocoa-Java applications:

Below the project group are other groups, including smart groups. Smart groups—identified by the purple folders on the left side of the column—allow you to sort the project’s files using custom rules in a way similar to using smart playlists in iTunes.

These are some of the other groups in the Groups & Files list:

Curious folks might want to look in the project directory to see what kind of files it contains. Among the project files are:

English.lproj

A directory containing resources localized to the English language. In this directory are nib files automatically created for the project. You may find other directories containing localized resources, such as Dutch.lproj.

main.m

An Objective-C file, generated for each project, that contains the entry-point code for the application.

Currency Converter.xcodeproj

This file contains information that defines the project. It should not be modified directly. You can open your project by double-clicking this file in the Finder.



< 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