Bouncing Ball -- Using Java Beans



Contents
Baseline of Homework

For this assignment, you are to write a JavaBean class, and then load it into the beanbox and use it in some way to make a new bean as appropriate: either set some properties or link some button events to methods in the bean.

Here are two ideas of beans that you might write:

Creativity and uniqueness are always appreciated.

Back to Top Page


Resources


Back to Top Page


About the Problem

About the Program

Bounce ball Java Bean is an example that demonstrates how Java's component architecture works. In this example, we use BDK (JavaBean's Development Kit), as the graphical programming environments, to configure components -- Bounce ball Java Bean and ExplicitButton Java Bean-- by specifying aspects of their visual appearance, in addition to the interactions between these components. This means that we can make an application -- Bounce ball bean with button control -- without actually writing any Java code when we have all the components made.



Back to Top Page


Properties of bouncing ball bean

Two hooked up Buttons

OPEN and STOP are methods used for building up connection to ExplicitButton Bean, which controls starting and resuming of the animation of the bouncing ball.

Properties of the bouncing ball

bounceBallColor is the property field used for changing the color of bouncing ball.

fontSize is the property field used for changing the size of signature.

bounceBallSize is the property field used for changing the size of bouncing ball.

ballInitpositionX is the property field used for setting the staring bouncing x-position.

ballInitpositionY is the property field used for setting the staring bouncing y-position.

animationRate is the property field used for changing the speed of bouncing.

ballWidth is the property field used for setting the width of bouncing ball.

ballHeight is the property field used for setting the height of bouncing ball.

Shape is the property field used for changing the shape (ecllips or rectangle) of bouncing.



Back to Top Page


Design Notes

This program is implemented in the following steps:

Bounce.java -- implementing a Bouncing ball in Java.

bounce.mk -- configure file for generating .jar file compiled using nmake15.exe .

Bounce.jar -- Bean file which is generated and copied to directory BDK/jars/ so that the new bean can be loaded into Beanbox -- graphical development environments from Toolbar window to the left of Beanbox window.

BounceBall.jar -- new Bean file which is generated from connecting to ExplicitButton Bean in Beanbox.

Back to Top Page


Source


Back to Top Page


Demo

The demo Bounce.jar is coded and tested with Netscape Communicator versions 4.5, 4.04 with AWT 1.1 patch on PC (Windows). To run the demo, Copy Bounce.jar to BDK/jars/ and load it into Beanbox.


Note

In order to run the bean -- Bounce.jar on a workstation, the following steps have to be executed:


It is unable to test most of the property features of the original bean after it has been hooked up with ExplicitButton bean and generated into a new bean.



Back to Homework Page