edu.luc.cs.trull.demo.counter
Class Counter
java.lang.Object
edu.luc.cs.trull.EmptyComponent
edu.luc.cs.trull.TerminatingComponent
edu.luc.cs.trull.AbstractComponent
edu.luc.cs.trull.EmitComponent
edu.luc.cs.trull.demo.counter.Counter
- All Implemented Interfaces:
- Component, EventLabels, PropertyChangeSource, Startable, Suspendable, VisualComponent, Terminating, java.beans.PropertyChangeListener, java.util.EventListener
public class Counter
- extends EmitComponent
- implements VisualComponent, EventLabels
A bounded counter implemented as a JavaBean
with Trull support only for event emission.
The current value of the counter is visualized as the position of a button
in a rectangle whose height is the maximum value times the height of the
button. The counter emits OUCH when the maximum value is reached and
PRESSED when the button is pressed.
view Triveni source
|
Constructor Summary |
Counter(java.lang.String buttonName,
int numSteps,
int width,
int height)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
b
private javax.swing.JButton b
buttonName
private java.lang.String buttonName
height
private int height
numSteps
private int numSteps
panel
private javax.swing.JPanel panel
position
private int position
width
private int width
Counter
public Counter(java.lang.String buttonName,
int numSteps,
int width,
int height)
getView
public javax.swing.JComponent getView()
- Description copied from interface:
VisualComponent
- Returns the Swing component associated with this Trull component.
- Specified by:
getView in interface VisualComponent
- Returns:
- the associated Swing component.
lowerButton
void lowerButton()
placeButton
void placeButton()
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent event)
- Specified by:
propertyChange in interface java.beans.PropertyChangeListener- Overrides:
propertyChange in class EmptyComponent
raiseButton
void raiseButton()
resetButton
void resetButton()
http://www.cs.luc.edu/trull/