Back to Starting Jamba
Up to Table of Contents
Ahead to What to Read Next

Lesson: Jamba Quick Start

This lesson helps you get started with the basic steps required to create a Jamba application or applet. You will be creating an application that contains three objects: a Graphic object, a Push Button, and an Audio object. Ultimately, when you run the application the Graphic and the Push Button will be visible. When you click on the Push Button, the Audio object will play automatically. Setting up the three objects will build a good foundation of skills that you'll need for working with other types of objects. For more information on all of the available objects, see Chapter 6.

Note that the simple example in this lesson is actually fairly representative of applets that you may want to create on your own. It is typical of the concise applets that many authors incorporate into their web pages. For more information on types of applets, applications, and design suggestions, see Chapter 8; Essential Design Concepts.

Important: Make sure to complete every required step in this lesson (and in any other lessons you do later in the manual). Otherwise, the application will not perform as expected. Required steps are preceded with a bullet and the instructions appear bolded.

A completed version of this lesson, called lesn_1, is located in the \Jamba\lessons directory.

Starting a New Project

The New Project dialog box appears.

This is where you name your application, decide which directory you want it to reside in, and set up the size of the window it will run in. If you name a directory that does not exist, Jamba creates it for you, along with a series of subdirectories in which you will store the files used by the application.

As mentioned earlier, when you save an application Jamba actually creates several files with different extensions (for example, MyApp.jmb, MyApp.html, and MyApp.jtf). However, you do not need to specify a file extension here. Jamba will append the appropriate extension for you.

Notice that as you type the name of the application, a directory with the same name is appended to the path in the Directory field. Later when you create your own applications and applets, you can optionally make further changes to the path in the Directory field.

When you click on OK, Jamba creates the required directory structure and opens a new project window. The following figure shows the contents of the directory when you name the project MyApp.

Notice that several directories are created to store files used by your project. For example, the Audio directory is where you store audio files and the Graphics directory is where you store graphics. Also, Jamba creates the three files with the . html, . jmb, and . jtf extensions.

The Jamba Project Window

When you start a new project, the first window that appears is called the Project window. It appears similar to the following:

The Project window is where you view thumbnails (small representations) of the pages that make up your application. Initially, your application contains one page, called StartPage. When you add new pages to your project, they appear in this window. Remember, however, that many applications (like the one in this lesson) only use one page.

The Page Layout Editor

Every page in your project can be viewed in the Page Layout Editor. This is where you draw objects on the page and set up the objects to perform as desired at runtime.

The area to the left is the object list. At first it just contains the name of the page which is a type of object. Later it will contain the names of any objects you add to the page. The right side of the Page Layout Editor is the layout area. This is where you draw the objects on the page.

If you plan to do some serious object layout work, you can maximize the Page Layout Editor. However, if at anytime you need to work in the Project window (for example, to add a new page) you can return to that window by clicking on the View Project button.

For now however, you'll continue working in the Page Layout Editor.

Setting the Window Size

Initially, the window in which your application runs is 640 x 480. This might be appropriate for some applications however, for most applets, you are likely to want a smaller window. You could have changed this when you first created the project, however, we'll show you how to change this after the project has been created. Once you change the window size, the new size becomes the default for subsequent projects.

The Page tab of the Project Settings dialog box appears.

This application will be 300 pixels wide and 200 pixels tall.

The size of the drawing area adjusts according to the size you specify.

Drawing Objects

First you'll draw a Graphic object. To draw an object you select the desired tool from the Object Palette (the vertical tool bar on the left side of the window) and draw a box in the Page Layout Editor. You don't have to worry about the exact position and size of the object because you can always change it afterwards.

Note that if you position the cursor over a button and wait a moment, Jamba displays a tool tip to tell you the purpose of the button.

The object appears similar to the following.

Notice that each object you add to the page is also added to the object list.

The object is named Graphic1 by default. If you add another graphic it will be called Graphic2, and so on. To change the name of an object, you would simply change its Name property. You'll learn how to set properties later in this lesson. However, in this application, you will use the default object names.

Later in the lesson you'll load a graphic file into the object. But first you'll finish drawing the other objects. Now draw the Push Button to the right of the graphic.

Now draw the Audio object. You can draw it to the left of the Push Button, although the Audio object will not be visible at runtime.

Notice that the Audio object is always the same size and is never visible at runtime.

Setting Object Properties

As mentioned previously, all objects have certain properties (characteristics) that you set to control their appearance. The first property you set will determine which graphic appears in the Graphic object you drew.

The properties for the selected object appear as follows.

This dialog box is called the Object Editor. The left column shows each property you can set. The right column is where you provide values for the properties. You'll use the Filename property to specify the graphic that appears in the object.

An Open dialog box appears that lets you browse for the desired file.

The file is automatically copied to the \MyApp\Graphics directory and is loaded into the Graphic object. The file has been copied to the appropriate directory. (If you can't read the entire value, you can position the cursor on the right edge of the dialog box and stretch it to the right to see more.)

Notice also that the Graphic object has automatically resized to fit the graphic. This is because the object's DrawStyle property is set to SizeByGraphic by default. The other options are to Tile or Clip the graphic, but most often you want to show the image in its entirety.

Before you move on to the Audio object, you'll set one more property of the Graphic object so that it uses a special display effect when it first appears.

The DisplayEffect Properties dialog box appears to let you select a special effect.

The Wipe effect sweeps the graphic onto the display. Now choose a Modifier to indicate the direction in which the Wipe should occur.

You'll leave the Size set to VerySmall but change the Speed to be a little faster.

The selected information is automatically returned to the Value field.

Next, you'll set up the Audio object to play an . au file called gorilla.au. You need to select the object in order to set its properties. You can select it by clicking on it, or you can click on the name of the object in the object list.

The properties list now shows the properties for the Audio object.

Note that the Object Editor remains open until you deliberately close it by clicking the X button in the top right corner. It simply changes to reflect the currently selected object.

An Open dialog box appears that lets you browse for the desired file.

The file is automatically copied to the \MyApp\Audio directory. The path and filename that now appear in the Value field for the Filename property show that the file has been copied to the appropriate directory.

The To Do List

The next concept you need to learn about is the To Do List which is one of Jamba's most powerful features. It tells the object what it should do when a particular event occurs. Here are some typical uses for the To Do List:

Example: When the user clicks on a Push button, its To Do List can cause a Text object to appear and also cause an Audio object to play.

Example: When a user clicks on a Graphic the object can disappear. Or, set up an Audio object so that when the page appears, the object receives a command to play.

Example: When a user makes a selection from a List Box, display a different page.

In this application, you'll set up the Push Button's To Do List so that when the user clicks on the button, the Audio object plays.

The Event field (the drop-down list in the top left corner) shows the event that will cause an action (called a To Do item) to occur. By default it is set to Click.

This default is appropriate because you want a To Do item action to occur when the user clicks.

The blank area that makes up most of the dialog box is where you enter the To Do items that occur for this event. In this case, you'll be setting up one item to instruct the Audio object to play. However, in other situations, you might want several actions to occur when the user clicks. Note also that the same object can have more than one To Do List, one for each event that you select.

Here's how to set up a To Do List item.

A drop-down list opens in the Object field.

The list contains each item that you potentially take action on when the user clicks on PushButton1: every object on the page, the name of the page(StartPage) and the entire application. You want to select Audio1 because that's the object you want to affect.

When you select Audio1, the list of possible actions appears automatically in the What To Do field.

The actions that are listed fall into two categories: properties and methods. The properties are the same kinds of properties (like Filename) that you can set for an object in its Property list. The other kinds of actions are called methods. Methods are special actions that command an object to do something, such as play a file. You can tell which actions are methods because they are followed by the "()" symbols. In some situations, because methods are commands, they do not require you to set the Value field.

You're finished setting up the To Do item for the Audio object. To get some more practice, next you'll set a property in the To Do List. Specifically, you will add an action that changes the background color of the page when the user clicks on PushButton1.

A drop-down list opens in the second line of the Object field.

The What To Do list opens automatically.

The Color dialog box appears to let you select a color for the page background.

The Color dialog box disappears and the corresponding RGB value is automatically returned to the Value field.

Each number in the RGB value represents the intensity (from 0-255) of Red, Green, and Blue that make up the selected color. The last task you'll do is to label the Push Button "Click Here".