Bongo for Dummies (with CD-ROM)

Overview

If nothing else, Java has inspired colorful names where before there was C++, COBOL, and FORTRAN. Bongo, the new Java development tool from Marimba, is a case in point. But Bongo is more than a colorful name -- as Bongo For Dummies makes abundantly clear. With this practical, easy-to-understand guide, you discover how to use Bongo to create multimedia-rich, interactive Web applets and stand-alone applications efficiently and without sacrificing your creativity to arcane coding. You also find out how to integrate ...
See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (5) from $17.95   
  • Used (5) from $17.95   
Close
Sort by
Page 1 of 1
Showing 1 – 4 of 5
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$17.95
Seller since 2013

Feedback rating:

(3)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

Very Good
1997-06-23 Very good

Ships from: Lexington, NC

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$71.29
Seller since 2014

Feedback rating:

(227)

Condition: Good
Possible retired library copy, some have markings or writing.

Ships from: Chatham, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$139.45
Seller since 2014

Feedback rating:

(227)

Condition: Very Good
Very good.

Ships from: Chatham, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$500.00
Seller since 2009

Feedback rating:

(22266)

Condition: Good
Our feedback rating says it all: Five star service and fast delivery! We have shipped four million items to happy customers, and have one MILLION unique items ready to ship today!

Ships from: Toledo, OH

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Page 1 of 1
Showing 1 – 4 of 5
Close
Sort by
Sending request ...

Overview

If nothing else, Java has inspired colorful names where before there was C++, COBOL, and FORTRAN. Bongo, the new Java development tool from Marimba, is a case in point. But Bongo is more than a colorful name -- as Bongo For Dummies makes abundantly clear. With this practical, easy-to-understand guide, you discover how to use Bongo to create multimedia-rich, interactive Web applets and stand-alone applications efficiently and without sacrificing your creativity to arcane coding. You also find out how to integrate your Bongo applications with Marimba's Castanet, the cutting-edge software and content distribution software that everyone's talking about. Plus, on the bonus CD-ROM accompanying Bongo For Dummies, you get try-out versions of Bongo and Castanet along with JavaSoft's Java Development Kit, a demo version of Sun's Java Workshop, and plenty of useful source code from the book.

Read More Show Less

Product Details

  • ISBN-13: 9780764501760
  • Publisher: International Data Group
  • Publication date: 6/1/1997
  • Series: For Dummies Series
  • Edition description: BK&CD-ROM
  • Edition number: 1
  • Pages: 359
  • Product dimensions: 7.38 (w) x 9.26 (h) x 0.98 (d)

Table of Contents

Introduction
About This Book
Conventions Used in This Book
Foolish Assumptions
How This Book Is Organized
Part I: Introducing . . . Bongo!
Part II: Creating Smart Presentations That Actually Do Something
Part III: Mixing Bongo with Castanet: Rhythm, Style, and Automatic Distribution
Part IV: The Part of Tens
Icons Used in This Book
Where to Go From Here
Part I: Introducing . . . Bongo!
Chapter 1: Mastering the Bongo Basics
What Is Bongo?
Presentations, Applications, Widgets, and Other Neat Words
Applications and programs
Widgets
Containers
Folders and pages
Windows onto Bongo
The Bongo Builder
The Presentation window
Getting Help
Working with Presentations
Starting and quitting Bongo
Creating a new presentation
Opening an existing presentation
Running a presentation
Saving a presentation
Closing a presentation
Working with Widgets
Adding a new widget
Selecting existing widgets
Resizing widgets
Moving widgets
Cutting, copying, pasting, duplicating, and deleting widgets
Grouping and ungrouping widgets
Working in a container
Working with folders
Working with Widget Properties
Common widget properties
Additional widget properties
Setting widget properties
Saving and resetting properties
Exterminating Bugs
Chapter 2: Widgets, Widgets Everywhere
Everything You Ever Wanted to Know about Bongo Widgets
Push My Buttons
Command button widgets
Menu button widgets
URL button widgets
Check box widgets
Option widgets
Color button widgets
Plain Old Text
Text box widgets
Static text widgets
Rich text box widgets
URL text widgets
Give Me a Choice
List box widgets
Drop-down list box widgets
Drop-down combo box widget
Containers for Everything
Group widgets
Group box widgets
More Containers: Folders, Pages, Lists, and Scrolling Containers
Folder widgets
Page widgets
List widgets
Scrolling container widgets
More Containers: Tables and Sparse Tables
Last of the Containers: Windows and Trees
Window widgets
Tree widgets
Tree node widgets
Modern Values
Progress indicator widgets
Scroll bar widgets
Slider widgets
Spin box widgets
Saturday Morning Animated Widgets
Animated text widgets
Animated image widgets
Shapely Widgets
Line widgets
Oval widgets
Rectangle widgets
Resourceful Widgets
Audio widgets
Image widgets
Presentation widget
AWT Widgets
Component widgets
Applet widget
Oh Yeah, Presentations Have Properties, Too
Geez, That's a Lot to Remember
Chapter 3: Testing the Waters with Simple Presentations
Some Presentation Pieces and Parts
Doing the logo thing
Reaching out with a simple ad banner
Arbor Day: Making a tree
Turning the tables (or making one)
Playing the Mix-and-Match Game by Combining Presentations
Getting the files ready
Snapping those puppies into place
Admiring your new creation
Part II: Creating Smart Presentations That Actually Do Something
Chapter 4: Interactivity with Half the Effort: Java Applets
What Are Those Applet Things, Anyway?
Yeah, so what can applets do for me?
Down 'n' dirty: A quick example
Anatomy of an Applet
Class files
Parameters
Resources
Marriage Counseling: Getting Applets and Presentations to Talk to Each Other
The parameter shuffle
A more useful example
Where to Find Those Sneaky Applets
General Applet Tips
Chapter 5: More Canned Fun with Third-Party Bongo Widgets
Other Widgets? What's Up with That?
Where to Find Them Widget Things
Installing and Using Third-Party Widgets
Step 1: Obtaining a widget
Step 2: Uncovering widget information
Step 3: Installing the widget files
Step 4: Adding the widget to a presentation
Step 5: Go to town, take a coffee break, or whatever
Chapter 6: Getting Those Buttons to Make Things Happen
Scripting 101
What if I'm not a Java nut?
OOPs (object-oriented programming stuff)
Variables
Working with variables and methods
Comparisons and statements
Flow control structures
Casting
Miscellaneous
Summary
Using Scripts to Win Friends and Impress Your Neighbors
Playing hide and seek with an image
Going to the source: Changing images and animations
Controlling an unruly animation
Sounding off
Playing with list boxes
Chapter 7: More Scripting Fun
The Main Event
Sounding Off with Fewer Clicks
Windows on the World
searchButton
browseButton
closeButton
More Action with Animated Buttons and Hotspots
searchButton
browseButton
buttonHours
buttonFinance
Animation Controls: The Next Generation
animatedPhone1
fastForwardButton
Hey Baby, Let's Drag
Chapter 8: How to Build Your Own Custom Widgets for Pocket Change
Getting that Custom Fit
You Need a Compiler!
Smarter Animations
Using the custom widget
The Java code
AnimatedImagePlusWidget.java
Even Smarter Animations
Code details
AnimatedImageSuperWidget.java
Hotspots -- Buttons with Attitude
Coding issues
HotspotButtonWidget.java
Key points to remember
Chapter 9: Using Bongo in Java Applications and Web Pages
Integrating Bongo with Java Applications and Java Applets
Familiar Examples
Using Bongo in a Java Application
ShowAndHide -- outside of Bongo
Opening windows, again
Using scriptless presentations as GUIs (separating logic from the interface)
Drag and drop
Doing the Browser Thing
Using scriptless presentations as GUIs
Viewing the Tree Browser, Web-style
Interactive presentations in Web pages
Advanced animation -- in a Web page
Points to remember
Chapter 10: Extending Presentations with Prebuilt Java Classes
Defining Business Objects (Do We Need a Tie for This?)
Getting Some Background
Using External Object Classes
Choosing a Tool
Building an External Business Object
Designing a business object or external class: an overview
Building a Customer object
Customer.java source code
Three Ways to Use Business Objects with Bongo
Integrating business objects with custom widgets
Using business objects and Bongo in Java applications
Integrating business objects using scripts
Part III: Mixing Bongo with Castanet: Rhythm, Style, and Automatic Distribution
Chapter 11: Sending Your Baby Out into the World Using Castanet
Updating without Tears or Allergic Reactions
Posting a Channel to a Castanet Transmitter
Phase one: Getting prepared
Phase two: Configuring the Publisher
Phase three: Posting the presentation
Phase four: Testing the channel
Distributing Updates and Fixes
Chapter 12: Castanet and You: Techie Details
Keeping Your Users Secure
Security and Data Access
Thread Creation Restrictions
Extending Java Applications in Order to Run Them in Castanet
Part IV: The Part of Tens
Chapter 13: Ten Great Bongo Features
Attractive Visual Design
Cool widgets and backgrounds
A friendly GUI builder
Reusable interfaces
Good Looks and Intelligence!
Bongo scripting
Integration with Java objects
Java applets
Bongo custom widgets
JavaBeans
The Flexibility of a Yoga Instructor
No more multiplatform blues
Painless distribution without waxes, creams, or pills
Chapter 14: Ten Presentation Design Tips
Take Advantage of Design Features
Develop a Visual Theme
Pay Attention to Symmetry, Alignment, and Balance
Ignore Symmetry, Alignment, and Balance
Design Presentations with an Intuitive Structure
Think Like a (Software) User
Get a Second Opinion
Choose a Set of Features with Users and Stick to It
Work with an Incremental Development Cycle
Balance Scripting with Outside Classes
Chapter 15: Ten Cool Things to Download
Animation Tools
Liquid Motion Pro
ShockWave
Page Layout
Texture
Net-It Now!
Database Access
JDBC
dbKona
dbAnywhere
CocoBase
Fresco
ObjectStore
General Resources
Marimba
Gamelan
Appendix: About the CD-ROM
System Requirements
Apple Macintosh
Windows PCs
Solaris workstations
What You'll Find
Bongo
Castanet Tuner and Transmitter
The Java Development Kit
Java WorkShop
Bongo and Castanet documentation
Adobe Acrobat Reader
Source code and files
Bonus chapters on data storage!
If You Have Problems of the CD-ROM Kind
Index
IDG Books Worldwide, Inc. End-User License Agreement
Binary Code License
Installation Instructions
IDG Books Worldwide Registration Card
Read More Show Less

First Chapter

Chapter 4

Interactivity with Half the Effort: Java Applets

In This Chapter

  • Explaining Java applets
  • Adding applets to Bongo presentations
  • Getting interactive

In this chapter, you see how to make Bongo presentations interactive simply by dropping in preprogrammed Java applets -- no coding necessary. You discover what applets are, where to find them, how to add them to presentations, and why one may want to do such a thing. The chapter ends with a few useful examples of how Java applets extend the behavior of static presentations.

What Are Those Applet Things, Anyway?

Applets aren't something you step in before having to wipe your shoe, they're not related to fruit trees, and they aren't cute little French versions of your favorite application. When Sun Microsystems came up with the Java language, it knew it needed some sort of hook; Sun had to find a way to get the world to accept Java if the new language was ever going to become the Next Big Thing. The first major step was to design Java programs so that they would run on all major operating systems without any modifications, or porting, in programmer-speak. This feature explains why Java applications, including Bongo, are known as portable programs that can run on most popular computer systems. A portable program is a mighty good thing if you want to get into Bongo, but you aren't one of the millions of Microsoft Windows users around the planet.

Although this flexibility was quite handy, it wasn't enough; after all, several good languages could already claim the same capabilities. Sun's stroke of brilliance was creating applets, Java applications to run inside Web browsers, not just on local disk drives. This capability is important for two main reasons. First, users don't have to download and install applications before they can use them. Users can simply click a Web page and automatically use the applet -- no muss, no fuss, and no messy residue. Second, because Java applets are forced to play inside a sandbox (meaning they can do neat stuff, but they can't mess with your computer), people can run them without risking security. This security feature is a big deal on the Internet, where thousands of nasty things can happen if you give the rest of the world access to all your computer's resources.

Why create a new cutesy word like applet instead of just calling it "a Java application that runs inside a Web browser and doesn't have access to various local system resources"? Well, not only is applet a heck of a lot easier to say, but it's also a new vocabulary word that gets positioned in people's minds, a hook that shows that Java is a hip, Net-enabled language that runs in browsers. Judging from the mad rush towards Java over the past few years, Sun's idea worked.

Yeah, so what can applets do for me?

Applets can accelerate you toward money, fame, and fortune, without all that hard work -- if you're lucky, that is. If not, you're still in the enviable position of being able to take advantage of thousands of interactive Java applets by including them in Bongo presentations.

If you're a designer, using Java applets is a good thing because chances are you don't spend your nights wading through HTML and Java texts finding out how to do technical stuff like creating custom event models for subclassed AWT GUI objects. If you can find an applet that's legally available for you to use, you can slap it right into a presentation without ever bothering to sink to the level of actual coding work. Or, if you have some programmer-type friends, you can get them to do the nasty stuff while you sit in your Bongo ivory tower, working with a mouse, graphics, and other fun things.

If you're a coder, you can save valuable programming time by using existing Java applets straight up or by making minor modifications. You also can develop your own custom applets from scratch that do all sorts of neat things, including database access, remote method invocation, file transfers, and other handy tasks. Whereas Bongo itself can be somewhat limiting (from a programming point of view), Java applets give you plenty of freedom.

Organizations can take advantage of this flexibility by creating collections of interactive Java applets that anyone can mix and match in Bongo presentations. With central storehouses of interactive components, programming and design teams can spend less time reinventing the wheel and more time playing with slick little toys. Um, make that more time addressing user concerns while achieving a high return on investment.

So no matter who you are, a Java applet is probably in your future -- especially if you're reading this book.

Down 'n' dirty: A quick example

Here's your chance to create a simple Bongo presentation. The example presentation for this section is something that may come in handy the next time you're stuck in a long staff meeting. (It's called MeetingAgenda, but as you see, it's really more useful for wasting time.) The source files and presentation are located in the Chapter04 directory on the CD-ROM.

To add a Java applet to a presentation, use the following steps (for information on how to work with widgets and widget properties, see Chapters 1 and 2):

  1. Choose New-->AWT-->A pplet in the Bongo presentation window to insert a blank Java applet into the presentation.

    A new applet widget appears in the upper-lefthand corner of the presentation.

  2. Position the applet widget where you want to see it in the presentation by selecting it and then dragging it with your mouse (just like with any other widget).

    The applet widget in my example is centered in the presentation.

  3. Select the applet and set its properties in the Bongo Builder window.

    Type whatever you want to appear as the applet's tool tip in the tip property. Enter the name of the applet, minus the .class extension, in the code property. Add any applet parameters in the parameters property. (For details on how to enter parameters, see the "Anatomy of an Applet" section, later in this chapter.) The applet properties for the example are shown in Figure 4-1.

  4. Run the presentation by either pressing the Esc key or choosing File-->Browse in the presentation window.

    You get a fully interactive applet -- one which most definitely embodies the media-rich enterprise nature of Bongo. Figure 4-2 shows the completed meeting agenda presentation that I created.

Okay, maybe the utility of an interactive tic-tac-toe program is debatable. But then, the same goes for many of the meetings I've been to. This example is just here to show how you can easily include an applet in a presentation. Basically, all I had to do is gather a few files, insert an applet widget, and tell the widget to use the TicTacToe Java applet.

Anatomy of an Applet

Before you start diving headfirst into an integrated world of applets and presentations, you should know a few applet basics. Every applet you find has class files, and many also require you to work with parameters and resources.

Class files

Class files are the actual compiled Java programs that make up the applet. In the example in the "Adding an applet widget" section, TicTacToe.class is the name of the applet used in the presentation.

These class files aren't compiled in the traditional sense, where programs are turned into machine code that can be read only on a Mac, Windows, or UNIX system. Ugh. Perish the thought! Instead, Java programs are compiled into files that can be run by a Java Virtual Machine, otherwise known as a Java VM. Because of this, any computer with a compatible Java VM can run compiled Java class files, regardless of the type of system used to create them.

Although the TicTacToe applet is contained in just a single class file, some applets are made up of several class files, with each class file signifying a different type of Java object. If you don't know what this object stuff means, don't sweat it -- the only important thing to know is that some applets use more than one class file, and you have to have access to all of them if you're going to use them in Bongo.

Class files themselves are case-sensitive, meaning that if you want your system to work, you have to get an exact match for all capital and lowercase letters in the name. For example, if you want to use an applet called TicTacToe.class, you can't refer to it as tictactoe.Class.

Also, if you're the technical type and have spent some time playing with applets, you may be familiar with the codebase parameter. This setting allows you to keep your class files in a separate directory or folder from the HTML file that hosts your Java applet. This parameter does not work in Bongo. Not even if you ask really, really nicely. All class files for an applet must be in the same directory as the presentation that uses them.

When working with applets, keep the following points in mind with respect to class files:

  • Make sure that you know the name of the main applet class file. This name, minus the .class extension, goes into the code property for the Bongo applet widget.
  • Applet names are case-sensitive.
  • You also need access to all the supporting class files the applet needs. Without all the extra classes, the applet simply won't work.
  • The codebase parameter doesn't work in Bongo.

Parameters

Parameters sound like some sort of complex testing rules, but they're really just some simple bits of data that an applet needs when it starts up. Parameters are actually similar to Bongo properties. Although the TicTacToe applet doesn't need any extra information to get going, other applets may need to learn a number of things. For example, consider the fading text applet, shown running in a Web browser in Figure 4-3.

The applet in Figure 4-3 shows text that fades in and out of the background color. You get to choose the font, the colors, the text itself, and a Net address where users will go if they click the text. The applet can even handle multiple text lines that fade in and out sequentially, but I don't get into that until a few more paragraphs. You set each of these different qualities in the applet by using parameters.

Look at the HTML file that was used to display the applet in Figure 4-3:

<applet code="Fade.class" width="375" height="35">
<param name="bgcolor" value="233A27">
<param name="txtcolor" value="FAFAFF">
<param name="changefactor" value="7">
<param name="text1" value="Please buy something!">
<param name="url1" value="http://BongoForDummies.com">
<param name="font1" value="Courier,BOLD,20">
</applet>

In it, you can see a number of lines starting with the text param name=, followed by some value= sections. Each param name denotes an applet parameter, with the value of the parameter following in the value= section of the line. In this case, the text1 parameter for the applet is being set to "Please buy something!" Other parameters include txtcolor for the color of the text, bgcolor for the background color (the color to which the text will fade), font1 for the text's font, and url1 for the URL or Net address that is associated with the text.

If you want to have several messages that fade in and out in sequence, you can add parameters for text2, url2, font2, text3, and so on.

Searching for parameters

Where do you find out about what applet parameters you need to use? Wherever you can. If the applet's author means for the applet to be redistributed, he or she probably includes a README or other text file explaining the parameters that the applet uses and what kind of values the parameters accept. Sometimes this documentation is included as comments in the HTML file that launches the applet, and sometimes it is in the actual Java source code.

If the applet was created in-house, you may have access to documentation that the author created, or you just may be able to speak to him or her yourself. Of course, if you're the genius who created the applet, you're always in luck!

What happens when you use an applet that doesn't have documentation? Well, cursing is normally a good start, followed by a coffee break. After that, I suggest looking through the HTML source that launches the applet to find out what parameters are being used. Even if the HTML file has no comments, you can normally get a good idea about what's going on.

Using parameters

You also can use parameters to incorporate the Fade applet into a presentation. (These files are also in the Chapter04 source directory on the included CD-ROM.) After creating a new presentation, add an applet widget and set its properties, as shown in Figure 4-4.

The code property is set to Fade, telling the presentation to access the Fade.class applet in the same directory. As a side note, if you look in the source code directory on the CD, you can see another class file associated with this applet called Thoughts.class. The Thoughts.class file isn't an applet; it contains a Java object class called Thoughts that assists the Fade applet in creating fading text. The Fade applet doesn't work unless Thoughts.class is available in the same directory -- Fade is a good example of an applet that uses multiple class files.

If this applet had only one parameter, bgcolor, it would already be finished. This applet had all sorts of parameters, however, and they just aren't going to fit onto a single line in the Bongo properties editor. So what's an aspiring Bongo master to do?

You can set multiple applet parameters by typing the parameters right into the applet widget itself.

If you Ctrl-click the applet widget, you can see that the existing parameter is already there. To enter more parameters, you can keep on typing, using as many lines as you want. Figure 4-5 shows how to enter parameters with multiple lines.

When adding parameters, keep two things in mind. First, Bongo users just don't go for all that ugly param name= and value= stuff. Nope. Just enter the name of the parameter, followed by an equal sign and the actual value. You don't need to use the double quotes.

Second, each parameter requires its own line. So if an applet uses five parameters, you must use five separate lines. After you are inside the widget editing the parameters, all you have to do is press Enter or Return to get a new line.

So the parameters from the original HTML file that launches the Fade applet (shown in the "Parameters" section, earlier in the chapter) now look like this:

bgcolor=C0C0C0
txtcolor=FFFFFF
changefactor=4
text1=Please buy something!
ur1l=http://Insight/DemoTest01/HomePage.htm
font1=Courier,BOLD,20

Figure 4-6 displays a handy presentation with fading text.

Maybe Figure 4-6 doesn't show the most persuasive or subtle ad banner in existence, but it's a good demonstration of an applet widget requiring multiple parameters nonetheless.

When working with applet parameters in Bongo, keep the following things in mind:

  • You can enter a single parameter in the parameters property.
  • If the applet has more than one parameter, you must type the parameters into the widget itself, with each parameter getting a new line.
  • No quotes, paramname= statements, or other such things are necessary. You need only the parameter name, an equal sign, and a value.

Resources

Resources are graphics, audio, data, and other files used by an applet. Unlike parameters, resources are actual files containing any sort of data or media the applet needs. If the applet uses resources, make sure to put them in the correct directory/folder location so that the applet can find them. Which location is the right location? That depends on the applet. Some applets call their resources from the same directory as the class files. Other applets look at a different directory, which is sometimes hard-coded into the applet, and sometimes specified in the parameters.

How do you know where the files go? Either by reading documentation on the applet or by looking at how it's used and figuring it out yourself. For those people who don't enjoy frustrating themselves, the first method is often preferable.

For an example of how resources are used, look at the audio and images subdirectories for the TicTacToe applet on the CD-ROM included with this book. You notice that the images subdirectory contains two GIF files, one for the X and one for the O. The audio directory holds the audio files used for moves and victories.

Marriage Counseling: Getting Applets and Presentations to Talk to Each Other

Tech people only past this point! This section discusses using the Bongo scripting capabilities to get those standoffish applets to interact with your presentations as well as your users. Accomplishing this interaction requires a little bit of knowledge about Java, Java applets, and Bongo scripting. For a good primer on this topic, see Chapter 6.

The parameter shuffle

Like all Bongo widgets, applets have behaviors or methods associated with them so that you can actually tell them what to do (in addition to just loading them and having them look pretty). Keep those puppies in line! Rule with an iron fist! You can see a complete list in the Bongo class hierarchy resource (found on the included CD-ROM and also at the Marimba Web site at http://www.marimba.com), but for now, the important ones are these five: setParameters(String), setCode(String), start(), stop(), and init().

setParameters()

The setParameters() method controls the applet widget parameter property that also can be set in the Bongo properties window. So if you want to, you can change the parameters for an applet while it's running, perhaps to change the message it displays. To do so, you enter a script that sends a new set of parameters in a string to the applet using setParameters().

If the applet in question requires more than one parameter, you need to include new line characters between each parameter in the parameter string. You can show new line characters in source code as ' ' (a single quote, followed by a backslash character, followed by another single quote).

For example, suppose that you want to change the Bongo sample Applets.gui presentation (included in the Bongo/demo/applets directory on your hard drive) to display a water molecule instead of an hyaluronic acid molecule when a button is pressed. After you name the applet you want to work with "switchableApplet," all you do is add the following script to the button:

public void action() {
AppletWidget applet = (AppletWidget) getWidget("switchableApplet");
applet.setParameters("model=models/water.xyz");
}

setCode()

Using setCode(), you can even change the code for the applet itself, programmatically switching over to another applet at run time. Why would you want to do such a thing? Because you can! Sure, you also can have multiple applets in a presentation and make them visible or invisible, but that doesn't give you the ability to do dynamic things while the presentation is running. With setCode(), you can programmatically load in new applets whenever you want, even if they hadn't yet been conceived of when you created the presentation in the first place!

Now try something a little fancier. Instead of just setting up a button to change the molecule shown, set up a pair of buttons. One will display the ethane molecule in the XYZApp applet, and the other will replace the applet with the TicTacToe applet. (Both applets are in the Bongo/demo/applets folder on your hard drive.)

You have to rewrite the script for the first button so that it sets the code as well as the parameters:

public void action() {
AppletWidget applet = (AppletWidget) getWidget("switchableApplet");
applet.setCode("XYZApp");
applet.setParameters("model=models/Ethane.xyz");
}

The script for the second button sets the code property to TicTacToe and also resets parameters to a blank string because TicTacToe doesn't use any parameters. If you don't reset the parameters property, the applet keeps its old parameters, potentially causing some problems down the line.

public void action() {
AppletWidget applet = (AppletWidget) getWidget("switchableApplet");
applet.setCode("TicTacToe");
applet.setParameters("");

}

Other AppletWidget methods

You can use start(), init(), stop(), resize(), and other applet widget methods to send standard Java messages to the applet. The start() and init() methods aren't necessary when changing code and parameter properties, but they can come in handy later, depending upon what the applet does in response to these messages.

When working with AppletWidgets in scripts, keep the following points in mind:

  • The setParameters() method resets an applet widget's parameters, and setCode() changes the actual applet displayed by the applet widget.
  • Remember to use embedded new line characters in your parameter string if there is going to be more than one parameter.
  • You don't have to call start(), init(), stop(), or other methods unless you specifically want to use them.

A more useful example

The FlexibleAd.gui presentation in the Chapter04 directory that's on the CD that comes with this book combines these ideas into an interactive ad that displays different applets and messages depending upon who the user is. If the user clicks the Alternative button, the ad shows a psychedelic Java animation (kind of like a lava lamp), along with a fading message. If the user clicks the Yuppie button, the fading message changes and the applet switches over to a slide show of expensive cars. See Figure 4-7 for examples of how the presentation changes.

I don't go into all the source code details here, especially because they've been covered earlier in this chapter (in the examples in the "The parameter shuffle" section). To see how it all works, just open the presentation up in Bongo (it's included on the CD-ROM in the Chapter04 directory/folder) and look at the scripts and properties. Cheers.

Where to Find Those Sneaky Applets

Fortunately, applets exist everywhere on the Web. One really good source is http://www.gamelan.com, a collection of hundreds of applets, many of which can be reused without charge. You can find all sorts of things there, from super-advanced nifty applets to some pretty mundane stuff. Of course, this site is only one source out of hundreds; you can find plenty of other sources on the Net by doing a search on AltaVista, Infoseek, HotBot, Yahoo!, or any of the other useful search engines.

Often, you may not find the exact applet you need when going through a Net resource or shareware collection. What to do? Either become a Java programmer or get to know one. One good thing about many free applets is that they include source code as well as class files. Because modifying an existing applet is easier than programming one from scratch, starting with prebuilt source code can be a handy way of jump-starting your applet programming career. If you're not the programming type, try contacting the author of the applet -- most people who post free applets do so as a means of attracting new business. Many are more than happy to create Java applets and applications at reasonable rates.

Whatever your means of finding and using applets, be sure to get the author's permission before including them in your work. Like written materials and other media, applets are intellectual property, and using them without permission can be illegal as well as being a bit cheesy. When in doubt, checking with the author is always the best step.

General Applet Tips

Don't confuse animated buttons and fading text with the limits of what applets can do for you. Any functionality that can be accomplished with Java can be wrapped into an applet and reused in a Bongo presentation. You can create complex, media-rich, dynamic applications that do anything your heart desires, custom objects that encapsulate valuable business rules and processes, or even animated Cheez Whiz globs!

Of course, someone's going to have to write all these applets, but why bother with pesky details? The important part here is that all sorts of valuable processes can be dropped into a presentation, and the person doing this dropping doesn't have to know all the details.

Here are some miscellaneous tips to remember when using Java applets in Bongo:

  • Applet backgrounds always obscure Bongo backgrounds. So if you want to have a nice tiled background in your applet, make sure that the applet can draw the background on its own.
  • Applets tend to obscure other widgets, even if they're supposed to be behind them. You can't do much about this other than to remember not to put widgets in front of or behind applets.
  • Directory, program, resource, and folder names with spaces in them cause all sorts of weird stuff to happen, including funky things that just don't make sense and can take a long time to debug. So don't use spaces in the actual filename or location of anything involved with Java or Bongo even if your operating system allows it.
  • All file and directory names are case-sensitive in UNIX and can't contain spaces. This case-sensitivity can be a problem if you design a presentation or applet on a Mac or Windows system and then move it onto a UNIX server to be distributed on the Internet or across an intranet. So LovelyPicture.GIF is not the same thing as LovelyPicture.gif. Have a consistent naming scheme and stick to it even if your native operating system doesn't care about case. Remember that your presentations will probably be run on all sorts of systems, and you want them to run properly.
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)