Vyoms OneStopTesting.com - Testing EBooks, Tutorials, Articles, Jobs, Training Institutes etc.
OneStopGate.com - Gate EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopMBA.com - MBA EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopIAS.com - IAS EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopSAP.com - SAP EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopGRE.com - of GRE EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
Bookmark and Share Rss Feeds

What is java bean box | Articles | Recent Articles | News Article | Interesting Articles | Technology Articles | Articles On Education | Articles On Corporate | Company Articles | College Articles | Articles on Recession
Sponsored Ads
Hot Jobs
Fresher Jobs
Experienced Jobs
Government Jobs
Walkin Jobs
Placement Section
Company Profiles
Interview Questions
Placement Papers
Resources @ VYOMS
Companies In India
Consultants In India
Colleges In India
Exams In India
Latest Results
Notifications In India
Call Centers In India
Training Institutes In India
Job Communities In India
Courses In India
Jobs by Keyskills
Jobs by Functional Areas
Learn @ VYOMS
GATE Preparation
GRE Preparation
GMAT Preparation
IAS Preparation
SAP Preparation
Testing Preparation
MBA Preparation
News @ VYOMS
Freshers News
Job Articles
Latest News
India News Network
Interview Ebook
Get 30,000+ Interview Questions & Answers in an eBook.
Interview Success Kit - Get Success in Job Interviews
  • 30,000+ Interview Questions
  • Most Questions Answered
  • 5 FREE Bonuses
  • Free Upgrades


Wipro Technologies
Tata Consultancy Services
Cognizant Technologies

Home » Articles » What is java bean box

What is java bean box

Article Posted On Date : Tuesday, March 2, 2010

What is java bean box

This is a basic tool that Sun provides for testing Java Beans.   To run the BeanBox, your computer needs to have access to a bdk installation.  To run the BeanBox, go to the beans/beanbox subdirectory and then type run.  This will bring up three windows:

  • The ToolBox window gives you a palette of sample Java Beans to choose from.
  • The BeanBox window is a container within which you can visually wire beans together.
  • The Properties window allows you to edit the properties of the currently selected Java Bean.
Try a simple example: choose Juggler bean from the ToolBox and drop an instance in the BeanBox window.  Also create two instances of OurButton.  Edit the labels of the buttons to read start and stop using the Properties window.  Now wire the start button to the juggler as follows.  Select the start button, then go to Edit | Events | action | actionPerformed.  Connect the rubber band to the juggler.  You will now see an EventTargetDialog box with a list of Juggler methods that could be invoked when the start button is pressed (these are the methods that either take an ActionEvent as an argument or have no arguments at all.)  Choose startJuggling as the target method and press OK.  The BeanBox now generates an adaptor class to wire the start button to the juggler.  Wire the stop button to the juggler's stopJuggling method in a similar manner.

Now that the program has been designed, you can run it within the BeanBox.  Simply press the start button to start juggling and press the stop button to stop juggling.  If you wish, you can turn your program into an applet by choosing File | MakeApplet in the BeanBox.  This will automatically generate a complete set of files for the applet, which can be run in the appletviewer.  (Do not expect current versions of Netscape and Internet Explorer to work with this applet.)

Let's take a closer look at how the BeanBox works.  On start up, it scans the directory beans/jars for files with the .jar extension that contain Java Beans.  These beans are displayed in the ToolBox window, from where they can be selected and dropped into the BeanBox window.  Next, we edited the labels of the two instances of OurButton.  The BeanBox determined that OurButton has a member named label by looking for setter and getter methods that follow standard naming conventions called design patterns.  If you look at the source code in beansdemosunwdemouttonsOurButton.java, you will see that OurButton has two methods named

     public void setLabel(String newLabel) {

     public String getLabel() {

Design patterns are an implicit technique by which builder tools can introspect a Java Bean.  There is also an explicit technique for exposing properties, methods and events.  This involves writing a bean information class, which implements the BeanInfo interface.

When we wired the start button to the juggler, the BeanBox set up the juggler to respond to action events generated by the start button.  The BeanBox again used design patterns to determine the type of events that can be generated by an OurButton object.  The following design patterns indicate that OurButton is capable of firing ActionEvents.

     public synchronized void addActionListener(ActionListener l) {

     public synchronized void removeActionListener(ActionListener l) {

By choosing Edit | Events | action | actionPerformed to connect the start button to the juggler, we were really registering an ActionListener with the start button.  The Juggler bean itself is does not implement the ActionListener interface.  Instead the BeanBox generated an event hookup adaptor, which implements ActionListener and simply calls the juggler's startJuggling method in its actionPerformed method:

    // Automatically generated event hookup file.

     package tmp.sunw.beanbox;
     import sunw.demo.juggler.Juggler;
     import java.awt.event.ActionListener;
     import java.awt.event.ActionEvent;

     public class ___Hookup_1474c0159e implements
           java.awt.event.ActionListener, java.io.Serializable {

         public void setTarget(sunw.demo.juggler.Juggler t) {
             target = t;

         public void actionPerformed(java.awt.event.ActionEvent arg0) {

         private sunw.demo.juggler.Juggler target;

A similar event hookup adaptor was generated when we wired the stop button to the juggler's stopJuggling method.

Why not make Juggler implement the ActionListener interface directly?  This is mainly a matter of convenience.  Suppose that Juggler implemented ActionListener and that it was registered to receive ActionEvents from both the start button and the stop button.  Then the Juggler's actionPerformed method would need to examine incoming events to determine the event source, before it could know whether to call startJuggling or stopJuggling.

Sponsored Ads

Interview Questions
HR Interview Questions
Testing Interview Questions
SAP Interview Questions
Business Intelligence Interview Questions
Call Center Interview Questions


Clipper Interview Questions
DBA Interview Questions
Firebird Interview Questions
Hierarchical Interview Questions
Informix Interview Questions
Microsoft Access Interview Questions
MS SqlServer Interview Questions
MYSQL Interview Questions
Network Interview Questions
Object Relational Interview Questions
PL/SQL Interview Questions
PostgreSQL Interview Questions
Progress Interview Questions
Relational Interview Questions
SQL Interview Questions
SQL Server Interview Questions
Stored Procedures Interview Questions
Sybase Interview Questions
Teradata Interview Questions

Microsof Technologies

.Net Database Interview Questions
.Net Deployement Interview Questions
ADO.NET Interview Questions
ADO.NET 2.0 Interview Questions
Architecture Interview Questions
ASP Interview Questions
ASP.NET Interview Questions
ASP.NET 2.0 Interview Questions
C# Interview Questions
Csharp Interview Questions
DataGrid Interview Questions
DotNet Interview Questions
Microsoft Basics Interview Questions
Microsoft.NET Interview Questions
Microsoft.NET 2.0 Interview Questions
Share Point Interview Questions
Silverlight Interview Questions
VB.NET Interview Questions
VC++ Interview Questions
Visual Basic Interview Questions

Java / J2EE

Applet Interview Questions
Core Java Interview Questions
Eclipse Interview Questions
EJB Interview Questions
Hibernate Interview Questions
J2ME Interview Questions
J2SE Interview Questions
Java Interview Questions
Java Beans Interview Questions
Java Patterns Interview Questions
Java Security Interview Questions
Java Swing Interview Questions
JBOSS Interview Questions
JDBC Interview Questions
JMS Interview Questions
JSF Interview Questions
JSP Interview Questions
RMI Interview Questions
Servlet Interview Questions
Socket Programming Interview Questions
Springs Interview Questions
Struts Interview Questions
Web Sphere Interview Questions

Programming Languages

C Interview Questions
C++ Interview Questions
CGI Interview Questions
Delphi Interview Questions
Fortran Interview Questions
ILU Interview Questions
LISP Interview Questions
Pascal Interview Questions
Perl Interview Questions
PHP Interview Questions
Ruby Interview Questions
Signature Interview Questions
UML Interview Questions
VBA Interview Questions
Windows Interview Questions
Mainframe Interview Questions

Copyright © 2001-2019 Vyoms.com. All Rights Reserved. Home | About Us | Advertise With Vyoms.com | Jobs | Contact Us | Feedback | Link to Us | Privacy Policy | Terms & Conditions
Placement Papers | Get Your Free Website | IAS Preparation | C++ Interview Questions | C Interview Questions | Report a Bug | Romantic Shayari | CAT 2019

Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |

Copyright ©2001-2019 Vyoms.com, All Rights Reserved.
Disclaimer: VYOMS.com has taken all reasonable steps to ensure that information on this site is authentic. Applicants are advised to research bonafides of advertisers independently. VYOMS.com shall not have any responsibility in this regard.