Creating beans in Java Technology

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;
}
public void setLabel(String s)
{
label=s;
}
public String getLabel()
{
return label;
}

// methods
public void colorchange()
{
setBackground(Color.blue);
}
}

C:\way2techworld> javac mycolorbean.java

create manifestation file :

a.mft is file name for example

C:\way2techworld>edit a.mft

Name: mycolorbean.class
Java-Bean: True

Now create jar file

C:\way2techworld> jar cfm c:\bdk\jars\color.jar a.mft mycolorbean.class

Leave a Reply