The Amplifier Circuit unit sits in the upper part of the applet and provides the vircuit view of the single-stage common-emmiter amplifier. This aprt contains the amplifier circuit and two moving waveforms -- the input waveform and the output waveform. This graphic unit is a GraphicComposite, since itself can be further divided into some small parts -- the circuit and the two moving waveforms. These three small units are the GraphicComponents, since they are not appropriate to be further divided.
The process of the construction of this part is much similar with that
of the lower part of the applet, which contains the Characteristic
Curve. Here we can have the AmplifierCircuit.java
inherite from the GraphicComposite.java.
This upper part then becomes the parent graphic of the three children GraphicComponents.
Then we need to create the three objects of the GraphicComponents and add
them into their parent GraphicComposite, which is the AmlifierCircuit.java
class.
//instantiate a circuit object instance
Circuits theCircuits = new Circuits(this);
//add it into its parent GraphicComposite, which is the AmplifierCircuit.java
this.addGraphicComponent(theCircuits);
//inform its parrent GraphicComposite that this GraphicComponent is fixed part,
//since the circuit is not changed during the simulation of the applet
setThisComponentAlwaysChanging(false);
//create and add the input moving waveform
MovingWaveform inputWave = new MovingWaveform(...);
this.addGraphicComponent(inputWave);
//create and add the output moving waveform
MovingWaveform outputWave = new MovingWaveform(...);
this.addGraphicComponent(outputWave);
Note: For the two moving waveforms, we don't have to set if this GraphicComponent is always changed, because by default the framework assumes that every graphic in the applet is a changed part. Here the moving waveforms are continuously moving and need to be redrawn each time. So by default, the framework will draw the two moving waveforms each time the applet screen needs to be updated.
After the parent GraphicComposite, which in this case is the AmplifierCircuit.java
and its three GraphicComponents -- the circuits and the two moving waveforms
are done. We have finished the work with the upper part's graphics construction
of the applet. For more detail, please consult the cource code of the Single-Stage
Common-Emitter Amplifier applet. Again, here we just give the simplified
code in this tutorial for easy understanding. The real applet code is sort
of complicated and hence not appropriate for learning of the Framework
itself.