Applets in a presentation

In this section you will be guided step by step through the process of adding an applet to a presentation. This is done using one of the sample presentations; in the applets directory you will find this example in applets.gui.


The FolderWidget

In the presentation builder window you have to choose File - New Presentation to create a new presentation. A new presentation window will pop up. In this case we will use a FolderWidget to make it possible to add some applets sometime later on new pages. The folder below is an example:

   the "tab control" area

Add a folder to your presentation by choosing New - Container - Folder. A FolderWidget will popup in the topleft of your new presentation. Resize it to fit the entire presentation by dragging one of the 8 small black rectangles (your mouse cursor will change to a double arrow). Next thing to do is give the first page the title "TicTacToe". For this you have to select the page: control click in the page, the black-yellow dashed line will move to the page, indicating that you are currently editing this container. In the properties window you will be able to enter a label, don't forget to hit the "apply" button afterwards.
If you want to add a new page to a folder, you have to select the folder again: control-click on the tab control area, holding down control in this case is necessary because you want to start editing in a different container (the presentation container). To add the page, choose Folder - New Page and a new page will appear at the right of the current page. You can change the label of this page in the same way as you did with the first page.


A simple applet

Now we have a folder. All that's left to do is add an applet. We'll use the TicTacToe applet for this example.

   the TicTacToe applet by Arthur van Hoff

To be able to do this we first have to save this presentation in the same directory as this applet. This applet is stored in the demo/applet/ subdirectory of you bongo directory. Save your presentation there.
Now we can add an AppletWidget to the first page. Control-click on the first page, the black yellow dashed line will switch to the page. Choose New - AWT - Applet to add an AppletWidget. Drag it to the position you like and take a look at the properties window. As you see there are only two additional properties: code and parameters. In code you specify the name of the applet class, in this case "TicTacToe". Since the applet does not take any parameters you are already done now. Hit the apply button and you will see that the applet appears instantaneously. Resize it to let it fit in the AppletWidget, choose File - Browse to switch to browse mode and you are ready to play!


Applet parameters

The TicTacToe was a very simple example. More advanced applets usually take some parameters which are passed to them using an html tag. The applet widget also support parameters. If it is just one parameter, this parameter can be set in the properties window. If there is more than one parameter involved, you will have to Control-click on the applet widget and set the parameters there, separated by newlines.

Below this is illustrated with two examples of html tags and the corresponding parameters in a Marimba Bongo presentation.

   <applet code=XYZApp.class width=300 height=300>
   <param name=model value=models/HyaluronicAcid.xyz>
   </applet>
 

   <applet codebase=GraphLayout code="Graph.class" width=400 height=400>
   <param name=edges value="joe-food,joe-dog,joe-tea,joe-cat,joe-table">
   <param name=center value="joe">
   </applet> 



As you can see, the one parameter applet can set the parameter in the properties window. The second applet sets two parameters, so inline editing must be used to set the parameters separated by newlines.


General rules

In order to use applets in presentations with the applet widget, there are three things you have to pay attention to:

  1. There is no such thing as a codebase. This means that the applet must be in the same directory as the presentation file.
  2. A single parameter can be entered in the properties window.
  3. Multiple parameters can only be entered using inline editing and separating the parameters with newlines.

If you pay attention to these three simple rules, this means you can reuse your existing applets in your new Bongo presentations!


Back to the tutorial index