Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 
Training Index

JavaBeansTM Short Course
Help: Creating The First Beans with Kaidi

By MageLang Institute

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

Help is available for each task, or you can go straight to the solution source code.

Task 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.

The basic design pattern for Bean properties is:

public void setPropertyName (PropertyType value);
public PropertyType getPropertyName();

The routines should be named something like getMessage and setMessage. The getMessage method should return the current message text. The setMessage method changes the current text. Don't forget to call repaint when the message changes.

Task 2

Compile the file.
Make sure the JDK's bin directory is in your PATH.
javac KivaHan.java

Task 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.
Shift-click on the KivaHanTester.java link to save.

Task 4

Compile the file.
javac KivaHanTester.java

Task 5

Save the KivaHanTester.html applet loader.
Shift-click on the KivaHanTester.html link to save.

Task 6

Use appletviewer to display the load the applet loader file.
appletviewer KivaHanTester.html
Copyright © 1997 MageLang Institute. All Rights Reserved.

[ This page was updated: 10-Nov-99 ]

Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.