COM 3240: Component-Based Programming
Prof. Lorenz
Out:
Apr
1, 2002
Due: Apr 15, 2002
Problem Set #3:
Adjusting Third-Party Component
Readings
Read Sections 15.2.3 and 15.3.1 in the
Textbook.
Goal
In this exercise you are to
"adjust" a third-party component to work with your visual
builder. Given a third-party Nand
component, for which you have only the class file (i.e., no source code), you are required to write a NandBeanInfo
class that will make it appear to the builder as a "normal" JavaBean.
You are given
- A
jar-file NAND.jar containing the Nand class.
- A
jar-file NAND-test.jar
containing 2 beans: BooleanSource and BooleanOutput.
- A
GIF image: nand.gif to be associated with the Nand
bean (as its icon).
You are required
- To
write a NandBeanInfo class that make the Nand bean to "look and feel" like the
friendly NandGate from Problem Set #1.
Instructions
- You
should study the API of
the give-away class in NAND.jar.
- (Load
the NAND.jar as is into the BDK1.1 and observe
its "misbehavior".)
- Write
for the Nand class a Java
bean-information class, named NandBeanInfo,
which implements the java.beans.BeanInfo interface. You may extend the class java.beans.SimpleBeanInfo, if you like, but do not use a code generator.
- The
NandBeanInfo class should "fix"
the appearance of the Nand class, so that
in the a visual bean-development tools, like the BDK, the Nand class would appear to have the same
"look and feel" as the NandGate
from Problem Set#1.
- Submit
the source file of your NandBeanInfo
class, and solution.jar to: com3240-grader@ccs.neu.edu with COM3240-EX3 in the subject
field.
Description of the give-away BooleanSource, and BooleanOutput
- These
are the same classes used in the Problem Set #1.
How to test your NandBeanInfo
in the BDK1.1
- To
test your new component in the BDK1.1, you will first have to create a jar
file, and then load it into the BeanBox.
- First,
however, you will need to compile your class.
- Your
NandBeanInfo class should be in the com3240
package. It should be in the same package as the Nand
bean.
- To
compile your class type:
javac -classpath NAND.jar com3240/NandBeanInfo.java
- To
be able to create a jar file, you would also need a manifest file.
For your convenience, the manifest file is provided here: solution.mf
- Chose
a nice GIF for you component (or download the nand.gif we used for Problem Set #1). If you chose
another GIF, make sure the dimensions are correct.
- Now
you are ready to create the jar file with both the bean and your BeanInfo in it, by typing (the order is important!):
jar xf NAND.jar
jar cfm solution.jar solution.mf nand.gif com3240/*.class