Академический Документы
Профессиональный Документы
Культура Документы
A bean obtains all the benefits of Javas write once, runanywhere paradigm.
The properties, events and methods of a bean that are exposed
to an application builder tool can be controlled.
A bean may be designed to operate correctly in different locales,
which makes it useful in global markets.
Auxiliary software can be provided to help a person configure a
bean.
The configuration settings of a bean can be saved in persistent
storage and restored at a later time.
A bean may register to receive events from other objects and can
generate events that are sent to other objects.
Features of JavaBeans
Beans
are
appropriate
for
software
components that can be visually manipulated
Class libraries are good for providing
functionality that is useful to programmers, and
doesnt benefit from visual manipulation
create objects from class libraries
we still need to write a large amount of code
objects are not enough
BDK Introspection
Properties
Types of Properties
Simple properties:
Boolean properties:
Indexed properties
An indexed property consists of multiple
values. It can be identified by the following
design patterns, where N is the name of the
property and T is its type.
Public T getN(int index);
Public void setN(int index, T value);
Public T[ ] getN( );
Public void setN(T values[ ]);
The Java 2 SDK must be installed on your machine for the BDK
to work. Confirm that the SDK tools are accessible from your
environment.
The BDK can then be downloaded from the JavaSoft site
(http://java.sun.com).
It is packaged as one file that is a self-extracting archive. Follow
the instructions to install it on your machine:
Starting the BDK
To start the BDK, follow these steps:
1. Change to the directory c:\bdk\beanbox.
2. Execute the batch file called run.bat. This causes the BDK to display
the three windows.
ToolBox contains the beans available
BeanBox window is the form where you visually wire beans together.
Properties sheet: displays the properties for the Bean currently
selected within the BeanBox window
Example
import java.awt.*;
import java.io.Serializable;
public class FirstBean extends Canvas
implements Serializable {
public FirstBean() {
setSize(50,30);
setBackground(Color.blue);
}
}
FirstBean
Name: FirstBean.class
Java-Bean: True
JAR Files
Manifest Files