Tag : Java

Bean Customization in Java Technology
Bean Customization in Java Technology

A bean appearance and behaviour can be customised at design time with ABT . But There are 2 ways -> by using Property Editor -> by using customizers Property Editors: using property sheet Event Adapter Classes The BeanBox generates an adapter class that interposes between the event source and target. The adapter class implements the appropriate event listener interface (and…

The BeanInfo Interface in JAVA BEANS
The BeanInfo Interface in JAVA BEANS

ABT examine a bean and expose its features (properties,methods and events) in a property sheet using java.beans.Introspector class. Introspection class uses JDK core reflection API to discover a bean methods and then applies the javabeans design patterns to discover the bean features. This discovery process is INTROSPECTION BeanInfo methods: PropertyDescriptor[] getPropertyDescriptors(); MethodDescriptor[] getMethodDescriptors(); EventSetDescriptor[] getEventsSetDescriptors(); BeanInfo classes contains DESCRIPTORS that…

Creating beans in Java Technology
Creating beans in Java Technology

1. create directory for new beans 2. create java source file 3. compile 4. create manifest file 5. generate a jar file 6. start BDK 7. RUN EXAMPLE : import java.awt.*; import java.awt.event.*; pubic class mycolorbean extends Canvas { private String label=””; Color mycolor= Color.red; // properties public void setMycolor(Color c) { mycolor=c; } public Color getMycolor() { return mycolor;…

PROPERTIES OF BEANS in JAVA TECHNOLOGY
PROPERTIES OF BEANS in JAVA TECHNOLOGY

3 TYPES OF PROPERTIES : 1. SIMPLE 2. BOOLEAN 3. INDEXED Simple property has a single value . It is identified by following design pattern: public T getN(); public void setN(T arg); T = type N = name – Read only property has only get method. – Write only property has only set method Example: public class Box { private…

Writing a Simple Bean in Java Technology
Writing a Simple Bean in Java Technology

Steps: 1. Write bean code and put it in a file in your own directory. Example: import java.io.Serializable; import java.awt.*; public class testbean exends Canvas implements Serializable { public testbean() { setSize(60,60); setBackground(Color.blue); } } 3. Compile javac testbean.java 4. Create manifest file – Edit test.mft Name: testbean.class Java-Bean: True 5. Create JAR file jar cfm testbean.jar test.mft testbean.class 6.…

INTROSPECTION in JAVA BEANS
INTROSPECTION in JAVA BEANS

Process of analyzing bean to determine its capabilities usingĀ Application Builder tool. Without introspection bean could not operated. We can provide introspection by 2 ways : 1. by following naming convention for setting properties , methods and events. 2. additional class provided that supplies info externally.

Install JDK for BDK to Work
Install JDK for BDK to Work

Starting BDK : 1. change directory to c:\bdk\beanbox 2. run batfile (Run.bat) set Autoexec.bat set classpath=c:\bdk1.2\lib; JAR FILES : – All beans are packaged in JAR file – JAR files allows you to efficiently deploy set of classes and their associated resources. – JAR contain text,audio,image and multimedia files – JAR technology makes it easy to deliver and install software…

Application Builder Tool in Java Beans
Application Builder Tool in Java Beans

Palleter or Tool box available that list all beans. We can add new bean components to this tool box. Worksheet allows designer to layout beans in GUI. A designed may drag or drop a bean from tool box to this worksheet Commands allow designed to enquire about state and behavior of beans.

Advantages of Bean
Advantages of Bean

Bean obtain write once run anywhere strategy Properties, methods and events exposed to application builder tool can be controlled Configuration setting of 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

Making Applet with Beans
Making Applet with Beans

File -> Make Applet -> jar file : C:\bdk\tmp\Myapplet.jar Make file: Myapplet Files created : 1. Jar file that contains all classes 2. HTML file 3. Readme file 4. A subdirectory To run applet C:\bdk\tmp> appletviewer Myapplet.html