Java® and Mac OS® X

Book description

Learn the guidelines of integrating Java with native Mac OS X applications with this Devloper Reference book.

Java is used to create nearly every type of application that exists and is one of the most required skills of employers seeking computer programmers. Java code and its libraries can be integrated with Mac OS X features, and this book shows you how to do just that.

You'll learn to write Java programs on OS X and you'll even discover how to integrate them with the Cocoa APIs.

  • Shows how Java programs can be integrated with any Mac OS X feature, such as NSView widgets or screen savers

  • Reveals the requirements for integrating Java with native OS X applications

  • Covers OS X libraries and behaviors unique to working with Java

With this book, you will learn that creating Java-based applications that integrate closely with OS X is not a myth!

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Table of contents

  1. Copyright
  2. About the Author
  3. Credits
  4. Introduction
    1. Understanding the Organization of This Book
      1. Getting Started
      2. Bringing Guidelines, APIs, and Languages Together
      3. Architecting Alternative Applications
    2. Using This Book
    3. Using the Companion Web Site
  5. I. Getting Started
    1. 1. Programming Java for OS X
      1. 1.1. Reviewing Apple Java History
      2. 1.2. Installing the OS X Developer Tools
      3. 1.3. Exploring the Apple Developer Connection
        1. 1.3.1. Exploring Reference Library topics
        2. 1.3.2. Finding developer articles
        3. 1.3.3. Obtaining software seeds
        4. 1.3.4. Benefiting from membership
      4. 1.4. Avoiding Deprecated Java Cocoa Libraries
        1. 1.4.1. Understanding the history of Java Cocoa libraries
        2. 1.4.2. Reviewing deprecated libraries
        3. 1.4.3. Understanding why Java Cocoa libraries were redundant
      5. 1.5. Exploring Available IDEs
        1. 1.5.1. Developing with Xcode
        2. 1.5.2. Developing with Eclipse
        3. 1.5.3. Developing with NetBeans
      6. 1.6. Summary
    2. 2. Introducing the Environment
      1. 2.1. Configuring the JVMs
        1. 2.1.1. Identifying JVM locations
        2. 2.1.2. Setting Java Preferences with "Java Preferences"
      2. 2.2. Adding Libraries
        1. 2.2.1. Exploring library locations
        2. 2.2.2. Including JARs and native libraries
        3. 2.2.3. Creating custom libraries
      3. 2.3. Finding Environment Variables
        1. 2.3.1. Setting JAVA_HOME
        2. 2.3.2. Exploring dot files and dot folders
        3. 2.3.3. Using system-wide properties
        4. 2.3.4. Accessing OS X environment
      4. 2.4. Summary
    3. 3. Understanding Xcode
      1. 3.1. Exploring Project Templates
        1. 3.1.1. Creating Java Console Application Projects
        2. 3.1.2. Creating Java application projects
        3. 3.1.3. Creating Java Applet projects
        4. 3.1.4. Using JNI Library projects
      2. 3.2. Highlighting Xcode Features
        1. 3.2.1. Browsing the welcome screen
        2. 3.2.2. Setting up a source code repository
        3. 3.2.3. Modifying the View
        4. 3.2.4. Watching tasks with the Activity window
        5. 3.2.5. Architecting with Xcode
        6. 3.2.6. Changing Xcode preferences
        7. 3.2.7. Inserting Java Code using macros
      3. 3.3. Using Organizer
        1. 3.3.1. Managing projects
        2. 3.3.2. Running projects
        3. 3.3.3. Creating Java projects from Organizer templates
      4. 3.4. Summary
    4. 4. Building Basic Projects
      1. 4.1. Building Xcode Projects
        1. 4.1.1. Understanding the Xcode Build Process
        2. 4.1.2. Running Xcode projects
        3. 4.1.3. Debugging Xcode projects
      2. 4.2. Writing Ant Build Files
        1. 4.2.1. Understanding Ant
        2. 4.2.2. Creating a basic Ant build file
        3. 4.2.3. Defining multiple targets
        4. 4.2.4. Learning properties and advanced elements
        5. 4.2.5. Configuring Ant options
      3. 4.3. Compiling from the Terminal
        1. 4.3.1. Reviewing the Java command-line tools
        2. 4.3.2. Configuring Javac
        3. 4.3.3. Scripting builds
      4. 4.4. Summary
    5. 5. Deploying Applications
      1. 5.1. Learning Application Bundle Basics
        1. 5.1.1. Contrasting bundles and packages
        2. 5.1.2. Exploring application packages
      2. 5.2. Creating Icons
        1. 5.2.1. Understanding Human Interface Guidelines for icons
        2. 5.2.2. Creating icons with Photoshop
        3. 5.2.3. Creating icons with Illustrator
        4. 5.2.4. Assembling the icon
      3. 5.3. Creating Packages with Jar Bundler
        1. 5.3.1. Understanding Jar Bundler options
        2. 5.3.2. Demonstrating Jar Bundler
      4. 5.4. Producing Installations
        1. 5.4.1. Understanding OS X installations
        2. 5.4.2. Creating DMGs for drag-and-drop installations
        3. 5.4.3. Creating PKG bundles
        4. 5.4.4. Creating izPack installations
      5. 5.5. Summary
  6. II. Bringing Guidelines, APIs, and Languages Together
    1. 6. Porting and Designing
      1. 6.1. Exploring Mac OS X Structure
        1. 6.1.1. Reviewing the architectural layers
        2. 6.1.2. Benefiting from OS X frameworks
      2. 6.2. Using Darwin
        1. 6.2.1. Examining the BSD foundations of OS X
        2. 6.2.2. Using Darwin tools
        3. 6.2.3. Exploring the Darwin libraries
        4. 6.2.4. Scripting Java in the shell
      3. 6.3. Learning the Human Interface Guidelines
        1. 6.3.1. Providing an OS X experience
        2. 6.3.2. Designing the user interface
        3. 6.3.3. Updating software
        4. 6.3.4. Integrating OS X technologies
      4. 6.4. Summary
    2. 7. Integrating Windows, Menus, and Dialog Boxes
      1. 7.1. Learning com.apple.eio.FileManager
        1. 7.1.1. Finding application bundles
        2. 7.1.2. Locating bundle resources
        3. 7.1.3. Getting and setting file types and creators
      2. 7.2. Investigating com.apple.eawt Classes
        1. 7.2.1. Manipulating the Dock
        2. 7.2.2. Opening the Help Viewer
        3. 7.2.3. Handling About, Preferences, and Quit
          1. 7.2.3.1. Persisting Preferences
          2. 7.2.3.2. Creating Human Interface compliant About boxes
        4. 7.2.4. Finding your mouse location
      3. 7.3. Summary
    3. 8. Embedding Cocoa Components
      1. 8.1. Integrating Objective-C and Java
        1. 8.1.1. Using Native in Java
        2. 8.1.2. Creating headers with javah
        3. 8.1.3. Exploring the C side of JNI
          1. 8.1.3.1. Cleaning Up Objective-C
          2. 8.1.3.2. Calling Objective-C methods
          3. 8.1.3.3. Converting Java Strings to NSStrings
        4. 8.1.4. Introducing Objective-C objects
        5. 8.1.5. Developing JNI with Ant
      2. 8.2. Coding with the CocoaComponent
        1. 8.2.1. Understanding CocoaComponent
          1. 8.2.1.1. Implementing sendMessage()
          2. 8.2.1.2. Creating Java callback methods
          3. 8.2.1.3. Declaring createNSViewLong()
          4. 8.2.1.4. Initializing native code
        2. 8.2.2. Introducing NSView
        3. 8.2.3. Embedding NSView in Swing
      3. 8.3. Employing the JNI Environment
        1. 8.3.1. Obtaining a JavaVM
        2. 8.3.2. Obtaining a jobject
        3. 8.3.3. Obtaining a jmethod
        4. 8.3.4. Obtaining a JNIEnv
      4. 8.4. Handling Events
      5. 8.5. Summary
  7. III. Architecting Alternative Applications
    1. 9. Understanding JNI
      1. 9.1. Reviewing JNI
        1. 9.1.1. Calling native code
        2. 9.1.2. Returning native variables to Java
        3. 9.1.3. Invoking Java from native code
          1. 9.1.3.1. Creating JVMs
          2. 9.1.3.2. Calling Java methods from C
          3. 9.1.3.3. Implementing Java calls from native code
        4. 9.1.4. Returning Java calls to native code
      2. 9.2. Building JNI Applications from Ant
      3. 9.3. Integrating with Objective-C
      4. 9.4. Learning Thread Safety
        1. 9.4.1. Reusing JavaVMs references
        2. 9.4.2. Threading with JNIEnv
        3. 9.4.3. Globalizing jclasses and jobjects
        4. 9.4.4. Saving jmethodIDs
      5. 9.5. Converting Strings
      6. 9.6. Finding More JNI Details
      7. 9.7. Summary
    2. 10. Creating Screen Savers
      1. 10.1. Understanding Screen Savers
        1. 10.1.1. Implementing screen savers
        2. 10.1.2. Initializing
        3. 10.1.3. Starting and stopping animation
        4. 10.1.4. Drawing an animateOneFrame
        5. 10.1.5. Creating simple screen savers
      2. 10.2. Integrating Java Controllers
        1. 10.2.1. Wrapping Objective-C with Java
          1. 10.2.1.1. Creating an Objective-C base of a Java screen saver
          2. 10.2.1.2. Invoking a JVM for a Java screen saver
          3. 10.2.1.3. Interfacing with a screen saver wrapper
          4. 10.2.1.4. Finishing implementation of a Java screen saver
        2. 10.2.2. Assembling screen savers manually
        3. 10.2.3. Configuring SAVER Info.plist
      3. 10.3. Wrapping NSBezierPath Commands
      4. 10.4. Summary
    3. 11. Creating Terminal Applications
      1. 11.1. Learning ANSI Escape Sequences
        1. 11.1.1. Configuring Terminal emulation
        2. 11.1.2. Printing in ANSI color
          1. 11.1.2.1. Choosing color brightness
          2. 11.1.2.2. Setting background colors
          3. 11.1.2.3. Completing the color sequences
        3. 11.1.3. Concealing passwords
      2. 11.2. Introducing Terminal UIs
        1. 11.2.1. Clearing the Terminal
        2. 11.2.2. Moving the cursor
        3. 11.2.3. Interacting with the Terminal
        4. 11.2.4. Making dialog boxes and menus
        5. 11.2.5. Creating a Terminal UI
      3. 11.3. Improving Terminal UIs
        1. 11.3.1. Introducing ncurses
        2. 11.3.2. Wrapping ncurses with Charva
        3. 11.3.3. Creating an advanced Terminal User Interface
      4. 11.4. Summary
  8. IV. Appendixes
    1. A. More Development Tools
      1. A.1. Exploring Design Tools
        1. A.1.1. Examining MagicDraw
        2. A.1.2. Investigating Poseidon for UML
      2. A.2. Exploring Additional Java Tools
        1. A.2.1. Reviewing JFormDesigner
        2. A.2.2. Examining IntelliJ IDEA
      3. A.3. Summary
    2. B. JUnit on OS X
      1. B.1. Writing Tests with JUnit
      2. B.2. Testing from Xcode with JUnit
      3. B.3. Summary
    3. Glossary

Product information

  • Title: Java® and Mac OS® X
  • Author(s): T. Gene Davis
  • Release date: May 2010
  • Publisher(s): Wiley
  • ISBN: 9780470525111