Technical: Java
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Title



Previous Section Table of Contents Next Section



Architecture of the SlideShow Application

The SlideShow project contains 11 source files:

  1. AboutDialog.java - contains the code for creating and displaying the application about box, visible when the user selects About SlideShow from the Apple Menu.
  2. BackwardButton.java - based on RolloverButton, this file contains code for behavior unique to the backwards button.
  3. CloseBoxButton.java - based on RolloverButton, this file contains code for behavior unique to the close box in the controller floating palette.
  4. Controller.java - contains the code for creating, displaying, and handling events associated with the controller floating palette and its associate buttons, the forward button, backward button, play/pause button, and the close box button.
  5. ForwardButton.java - based on RolloverButton, this file contains code for behavior unique to the forward button.
  6. ImageButton.java - the base class for all of the button objects, this source implements common button behavior such as the ability to load and display images in the button.
  7. ImageNameFilter.java - this source file contains code for filtering non-image files from the open file dialog.
  8. Misc.java - contains miscellaneous routines for loading images.
  9. PlayPauseButton.java - based on RolloverButton, this file contains code for behavior unique to the play/pause button.
  10. RolloverButton.java - based on ImageButton, this file contains code for extending the ImageButton class to handle multiple image states in response to user interaction.
  11. SlideShow.java - the main application class, this file contains code for displaying the slideshow window, creating and maintaining menu items, opening image files, and responding to user interaction.

As you can see from this brief synopsis of the source files involved, there is quite a bit of functionality in such a “simple” application. In order to make this tutorial easier to follow and understand, we have broken the implementation of these classes into separate HTML files. Each HTML file contains a series of steps which explains the code that will be added to the source skeleton in order to implement all of the necessary functionality provided by the class.

Clippings WindowEach source file in the project has a folder in the Source Clippings folder. For example, the first file, AboutDialog.java, has a corresponding folder called AboutDialog. As the picture left illustrates, this folder contains a number of text clippings. These clippings will be dragged into the source file at predetermined locations in order to “flesh out” a specific method or add additional code.

Each clipping is named in a manner that summarizes the functionality of that particular code snippet. For example, AboutDialog Setup indicates that the code snippet is used to setup the dialog. For clarity, all snippets will start with the name of the source file they belong to.

Throughout this tutorial, we will be specific about which source clipping should be used, and where it should be placed in the code. When there is a section of code near an area of code that needs an added text clipping, we will use the following format throughout the tutorial:


/**
 * This method does something
 */
 void foo ( int x )
 {
    // comment that tells the user which clipping to insert
    // i.e., insert myClass foo 

Note that the top area is in a light blue gray color. This region contains the code preceding the area where the clipping will be inserted.

The next area is a light yellow color. This shows the comment in the source that indicates the clipping to be used. The specific clipping should be inserted on the line immediately following this comment.


Beginning the Drag

We recommend that you arrange your source window and the clipping window in the Finder so that you can see both simultaneously. This will facilitate dragging. See the picture above for an example.

With the source window as the front most window, click on the clipping to be dragged into the source file, and drag the file to the source window.


Ending the Drag

You will see an I-Beam cursor indicating where the clipping will be placed (see picture above). Make sure that you place the clipping precisely. Poor placement may result in compile errors. Frequently, there will be a blank line immediately following the comment where the clipping goes. Be careful to place the clipping before any trailing closing brace character “}”.

In the tutorial file, a section will show the source after a successful drag operation. Make sure that your source matches this block.


/**
 * This method does something
 */
 void foo ( int x )
 {
// comment that tells the user which clipping to insert // ie, insert myClass foo
    System.out.println( "x: " + x );
}

The top section (in light blue) is shows the contents of the skeleton file. The darker blue area shows the contents of the newly added text clipping. This color scheme makes it easy to see what code preexists in the skeleton, and what code is added by the clipping.

Now that we have described the process of creating the complete source file using the skeleton file and the clipping, let’s start building the project!


Back to top



Previous Section Table of Contents Next Section



[an error occurred while processing this directive]