Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

JavaBeans Short Course

 
Training Index

Short Course

[Tutorial Contents]
[Behavior] [Help] [API Docs] [Solution]



Skeleton Code

According to The People's Chronology (Henry Holt and Company: 1994), the Arab goatherd Kaidi in east Africa discovered coffee in 850 when he noticed that his goats became frisky after chewing berries from certain wild bushes. In addition, in 1475, the world's first coffeehouse opened in Constantinople under the name of Kiva Han.

This exercise takes you through the steps to extend the bean, KivaHan, into a more useful one and use it within an applet.

Perform the following tasks:


  1. The KivaHan skeleton is your basic non-scrolling billboard. It always displays "Coffee: 10 lira". [The lira is the basic monetary unit in Turkey.] It is your job to convert the displayed message to a Bean-property by adding a getter/setter pair of routines.

  2. Compile the file.

  3. Now that you've created your first Bean, save the KivaHanTester.java applet that uses it. For now, don't worry about providing a means to change the default message.

  4. Compile the file.

  5. Save the KivaHanTester.html applet loader.

  6. Use appletviewer to display the load the applet loader file.

Although there is more that could be done with this Bean, what you have created is in fact a Bean. The next exercise builds upon this to do a bit more.

The task numbers above are linked to the step-by-step help page. Also available is a complete solution to the problem, and expected behavior, to demonstrate it.

Copyright © 1997 MageLang Institute. All Rights Reserved.