0% found this document useful (0 votes)
8 views5 pages

Beans Program

The document provides instructions for using the Bean Development Kit (BDK) to create and configure instances of built-in Beans, specifically the Molecule Bean and OurButton Bean. It outlines steps to start the BDK, manipulate the Beans in the BeanBox, and set up event handling for button actions. Additionally, it includes a brief guide on creating a user-defined Bean, including coding, compiling, and generating a JAR file for use within the BDK.

Uploaded by

mayankggn4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Beans Program

The document provides instructions for using the Bean Development Kit (BDK) to create and configure instances of built-in Beans, specifically the Molecule Bean and OurButton Bean. It outlines steps to start the BDK, manipulate the Beans in the BeanBox, and set up event handling for button actions. Additionally, it includes a brief guide on creating a user-defined Bean, including coding, compiling, and generating a JAR file for use within the BDK.

Uploaded by

mayankggn4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

**Write a Program to use built in

Beans.**
Starting the BDK:
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 lists all of the different Beans that have been
included with the BDK. BeanBox provides an area to lay out and connect the
Beans selected from the ToolBox. Properties provides the ability to
configure a selected Bean. You may also see a window called Method Tracer.

Using the BDK:


Molecule Bean displays a three-dimensional view of a molecule. This
component also has methods that allow the molecule to be rotated in space
along its X or Y axis.

Create and Configure an Instance of the Molecule Bean:


1. Position the cursor on the ToolBox entry labeled Molecule and click the left
mouse button. The cursor change to a cross.
2. Move the cursor to the BeanBox display area and click the left mouse button
in approximately the area where the Bean to be displayed. A rectangular
region appear that contains a 3-D display of a molecule. This area is
surrounded by a hatched border, indicating that it is currently selected.
3. Reposition the Molecule Bean by positioning the cursor over one of the
hatched borders and dragging the Bean.
4. Change the molecule that is displayed by changing the selection in the
Properties window. Notice that the Bean display changes immediately when
you change the selected molecule.

Create and Configure an Instance of the OurButton Bean:


Position the cursor on the ToolBox entry labeled OurButton and click the left
1.
mouse button. The cursor change to a cross.
2. Move the cursor to the BeanBox display area and click the left mouse button
in approximately the area where the Bean to be displayed. You should see a
rectangular region appear that contains a button. This area is surrounded by a
hatched border indicating that it is currently selected.
3. Reposition the OurButton Bean by positioning the cursor over one of the
hatched borders and dragging the Bean.
4. Go to the Properties window and change the label of the Bean to “Rotate X”.
The button appearance changes immediately when this property is changed.
5. Go to the menu bar of the BeanBox and select Edit | Events | action |
actionPerformed. See a line extending from the button to the cursor. Notice
that one end of the line moves as the cursor moves. However, the other end of
the line remains fixed at the button.
6. Move the cursor so that it is inside the Molecule Bean display area, and
click the left mouse button. See the Event Target Dialog dialog box.
7. The dialog box allows you to choose a method that should be invoked when
this button is clicked. Select the entry labeled “rotateOnX” and click the OK
button. A message box appear very briefly, stating that the tool is “Generating
and compiling adaptor class.”
Test the application. Each time you press the button, the molecule should
move a few degrees around one of its axes. Now create another instance of the
OurButton Bean. Label it “Rotate Y” and map its action event to the “rotateY”
method of the Molecule Bean. The steps to do this are similar to those just
described for the button labeled “Rotate X”. Test the application by clicking
these buttons and observing how the molecule moves.
/*OUTPUT */ :
Aim: Program to create a user defined bean.

1. Create a directory for the new Bean.

2. Create the Java source file(s).

3. Compile the source file(s).

4. Create a manifest file.

5. Generate a JAR file.

6. Start the BDK.

7. Test.

(Source file)

import javax.swing.*;

public class Logo1 extends JPanel{

private String sname="My logo";

JLabel lname;

JTextField tname;

public Logo1(){

lname=new JLabel(sname);

tname=new JTextField(10);

add(lname); add(tname);}

public void setSname(String str){

sname=str;

lname.setText(sname);}

public String getSname(){


return sname;}}

(Manifest file)

Manifest-Version: 1.0

Name: Logo1.class

Java-Bean: True

Output:-

Load the jar file by using menu File->Load jar. Now use the bean loaded and change its
property‘sname’.

You might also like