|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnextapp.echo2.app.Component
echopointng.ComponentEx
echopointng.AbleComponent
echopointng.Calculator
public class Calculator
Calculator is a component that acts like a hand held
calculator.
Its acts a bit like a TextField in that it has a backing
Document and it can raise action events when you press the
Transfer button, if its present (which by default is not present).
The Transfer button can be used to raise an event so that other components can know about the contents of the Calculator.
Take care when setting text into the Calculator, it will call isValidNumber() to ensure that the calculator can take the input. if it cant (eg not a decimal number, then it will throw an IllegalArgumentException.
| Field Summary | |
|---|---|
static java.lang.String |
ACTION_LISTENERS_CHANGED_PROPERTY
|
static java.lang.String |
DEFAULT_NUMBER_MASK
|
static Style |
DEFAULT_STYLE
|
static java.lang.String |
DOCUMENT_CHANGED_PROPERTY
|
static java.lang.String |
INPUT_TRANSFER
|
static java.lang.String |
PROPERTY_ACTION_COMMAND
|
static java.lang.String |
PROPERTY_BUTTON_BACKGROUND
|
static java.lang.String |
PROPERTY_BUTTON_HEIGHT
|
static java.lang.String |
PROPERTY_BUTTON_NUMBER_FOREGROUND
|
static java.lang.String |
PROPERTY_BUTTON_OPERATOR_FOREGROUND
|
static java.lang.String |
PROPERTY_BUTTON_WIDTH
|
static java.lang.String |
PROPERTY_DISPLAY_BACKGROUND
|
static java.lang.String |
PROPERTY_DISPLAY_FONT
|
static java.lang.String |
PROPERTY_DISPLAY_FOREGROUND
|
static java.lang.String |
PROPERTY_MEMORY
|
static java.lang.String |
PROPERTY_TRANSFER
|
static java.lang.String |
TEXT_CHANGED_PROPERTY
|
| Fields inherited from class echopointng.ComponentEx |
|---|
PROPERTY_HIDDEN |
| Fields inherited from interface echopointng.able.AccessKeyable |
|---|
PROPERTY_ACCESS_KEY |
| Fields inherited from interface echopointng.able.Borderable |
|---|
PROPERTY_BORDER |
| Fields inherited from interface echopointng.able.MouseCursorable |
|---|
CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, PROPERTY_MOUSE_CURSOR, PROPERTY_MOUSE_CURSOR_URI |
| Fields inherited from interface echopointng.able.Insetable |
|---|
DEFAULT_INSETS, DEFAULT_OUTSETS, PROPERTY_INSETS, PROPERTY_OUTSETS |
| Fields inherited from interface echopointng.able.Widthable |
|---|
PROPERTY_WIDTH |
| Fields inherited from interface echopointng.able.Heightable |
|---|
PROPERTY_HEIGHT |
| Fields inherited from interface echopointng.able.ToolTipable |
|---|
PROPERTY_TOOL_TIP_TEXT |
| Constructor Summary | |
|---|---|
Calculator()
Constructs a Calculator |
|
Calculator(Document document)
Constructs a Calculator with the specified backing
Document |
|
| Method Summary | |
|---|---|
void |
addActionListener(ActionListener l)
Adds an ActionListener to the Calculator. |
java.lang.String |
getActionCommand()
Returns the action command which will be provided in ActionEvent s fired by this Calculator. |
Color |
getButtonBackground()
|
Extent |
getButtonHeight()
|
Color |
getButtonNumberForeground()
|
Color |
getButtonOperatorForegound()
|
Extent |
getButtonWidth()
|
Color |
getDisplayBackground()
|
Font |
getDisplayFont()
|
Color |
getDisplayForeground()
|
Document |
getDocument()
Returns the model associated with this TextComponent. |
java.lang.String |
getMemory()
|
java.lang.String |
getText()
Returns the text contained in the Document model of this
text component. |
java.lang.String |
getTransfer()
|
boolean |
hasActionListeners()
Determines the any ActionListener s are registered. |
boolean |
isValidNumber(java.lang.String numberText)
This method is called to determine wether the text parameter is a valid number to be placed inside the calculator or its memory. |
void |
processInput(java.lang.String inputName,
java.lang.Object inputValue)
Processes client input specific to the Component
received from the UpdateManager. |
void |
removeActionListener(ActionListener l)
Removes an ActionListener from the Calculator. |
void |
setActionCommand(java.lang.String newValue)
Sets the action command which will be provided in ActionEvent s fired by this Calculator. |
void |
setButtonBackground(Color newValue)
Sets the background color of the calculator's buttons |
void |
setButtonHeight(Extent newValue)
Sets the height of the calculator's buttons |
void |
setButtonNumberForeground(Color newValue)
Sets the foreground color of the calculator's buttons that are numbers |
void |
setButtonOperatorForeground(Color newValue)
Sets the foreground color of the calculator's buttons that are operators |
void |
setButtonWidth(Extent newValue)
Sets the width of the calculator's buttons |
void |
setDisplayBackground(Color newValue)
Sets the background color of the calculator's number display |
void |
setDisplayFont(Font newValue)
Sets the font of the calculator's number display |
void |
setDisplayForeground(Color newValue)
Sets the foreground color of the calculator's number display |
void |
setDocument(Document newValue)
Sets the model associated with this TextComponent. |
void |
setMemory(java.lang.String newValue)
Sets the string value into the calculators memory |
void |
setText(java.lang.String newValue)
Sets the text of the document model of this calculaor. |
void |
setTransfer(java.lang.String newValue)
Sets the string value for the Transfer button. |
| Methods inherited from class echopointng.AbleComponent |
|---|
getAccessKey, getBorder, getHeight, getInsets, getMouseCursor, getMouseCursorURI, getOutsets, getToolTipText, getWidth, setAccessKey, setBorder, setHeight, setInsets, setMouseCursor, setMouseCursorURI, setOutsets, setToolTipText, setWidth |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Methods inherited from interface echopointng.able.Delegateable |
|---|
getRenderProperty, getRenderProperty |
| Field Detail |
|---|
public static final java.lang.String ACTION_LISTENERS_CHANGED_PROPERTY
public static Style DEFAULT_STYLE
public static final java.lang.String DOCUMENT_CHANGED_PROPERTY
public static final java.lang.String INPUT_TRANSFER
public static final java.lang.String PROPERTY_ACTION_COMMAND
public static final java.lang.String PROPERTY_BUTTON_BACKGROUND
public static final java.lang.String PROPERTY_BUTTON_OPERATOR_FOREGROUND
public static final java.lang.String PROPERTY_BUTTON_NUMBER_FOREGROUND
public static final java.lang.String PROPERTY_BUTTON_HEIGHT
public static final java.lang.String PROPERTY_BUTTON_WIDTH
public static final java.lang.String PROPERTY_DISPLAY_BACKGROUND
public static final java.lang.String PROPERTY_DISPLAY_FONT
public static final java.lang.String PROPERTY_DISPLAY_FOREGROUND
public static final java.lang.String PROPERTY_MEMORY
public static final java.lang.String PROPERTY_TRANSFER
public static java.lang.String TEXT_CHANGED_PROPERTY
public static final java.lang.String DEFAULT_NUMBER_MASK
| Constructor Detail |
|---|
public Calculator()
Calculator
public Calculator(Document document)
Calculator with the specified backing
Document
document - -
the backing Document| Method Detail |
|---|
public void addActionListener(ActionListener l)
ActionListener to the Calculator.
The ActionListener will be invoked when the user presses
the Transfer button in the calculator.
l - the ActionListener to addpublic java.lang.String getActionCommand()
ActionEvent s fired by this Calculator.
public Color getButtonBackground()
public Color getButtonOperatorForegound()
public Color getButtonNumberForeground()
public Extent getButtonHeight()
public Extent getButtonWidth()
public Color getDisplayBackground()
public Font getDisplayFont()
public Color getDisplayForeground()
public Document getDocument()
TextComponent.
public java.lang.String getMemory()
public java.lang.String getTransfer()
setTransfer(String)public java.lang.String getText()
Document model of this
text component.
public boolean hasActionListeners()
ActionListener s are registered.
public void processInput(java.lang.String inputName,
java.lang.Object inputValue)
ComponentComponent
received from the UpdateManager.
Derivative implementations should take care to invoke
super.processInput().
processInput in class ComponentinputName - the name of the inputinputValue - the value of the inputComponent.processInput(java.lang.String,
java.lang.Object)public void removeActionListener(ActionListener l)
ActionListener from the Calculator.
l - the ActionListener to removepublic void setActionCommand(java.lang.String newValue)
ActionEvent s fired by this Calculator.
newValue - the new action commandpublic void setButtonBackground(Color newValue)
newValue - -
the new valuepublic void setButtonOperatorForeground(Color newValue)
newValue - -
the new valuepublic void setButtonNumberForeground(Color newValue)
newValue - -
the new valuepublic void setButtonHeight(Extent newValue)
newValue - -
the new valuepublic void setButtonWidth(Extent newValue)
newValue - -
the new valuepublic void setDisplayBackground(Color newValue)
newValue - -
the new valuepublic void setDisplayFont(Font newValue)
newValue - -
the new valuepublic void setDisplayForeground(Color newValue)
newValue - -
the new valuepublic void setDocument(Document newValue)
TextComponent.
newValue - the new model (may not be null)public boolean isValidNumber(java.lang.String numberText)
numberText - -
the text to check
public void setMemory(java.lang.String newValue)
newValue - public void setTransfer(java.lang.String newValue)
newValue - public void setText(java.lang.String newValue)
newValue - the new text
java.lang.IllegalArgumentException - -
if the text cannot be converted into a number that the
calculator can handle.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||