We’ve managed to cover all of the basic concepts necessary for developing JavaBeans components. Before we get into the more advanced topics, however, it would be worthwhile to look at a larger example than those we’ve done previously. This will give us the opportunity to apply everything we’ve done to this point, and to see how some of the concepts and techniques play together.
In many of the previous examples, we’ve used objects that related to a temperature control simulator, such as a thermostat and a temperature source. In this chapter, we build the entire simulator. This includes all of the Beans and support classes, as well as a JAR file and a sample applet. We’ll add on to the code developed here as new topics are introduced later in the book.
Before we start writing code, it would be a good idea to define what we want to build. Let’s specify some simple requirements for the simulator. We want the system to exhibit the following characteristics and behaviors:
The simulator will monitor and alter the ambient temperature of the system.
There must be a mechanism for raising and lowering the temperature according to a desired value.
There must be a way to view the ambient temperature of the system in either Celsius or Fahrenheit.
The entire simulation must be serializable.
The next step is to interpret the requirements. Our interpretation will lead to the identification of the major components of the system, ...