Class ui.Key
All Packages Class Hierarchy This Package Previous Next Index
Class ui.Key
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----ui.Key
- public class Key
- extends Canvas
A button on the calculator key pad.
Each button has two modes: normal and shift. The mode is indicated by
the color, either activeColor or deactiveColor.
If the message label is set for the key, information about the key will
be displayed on the label when it gains focus.
-
key
- Key in normal state.
-
keyMsg
- Information about the key in normal state.
-
name
- Name of the key.
-
shiftkey
- Key in shifted state.
-
shiftkeyMsg
- Information about the key in shifted state.
-
Key(String, String, String, String, String, Label)
- Create a key with a name,
normal key string, information about normal key string,
shifted key string, information about shifted key string,
and a message label.
-
action(Event, Object)
- Called if an action occurs in the Component.
-
disable()
- Disable the key.
-
enable()
- Enable the key.
-
key()
- Return the current meaning of the key.
-
mouseDown(Event, int, int)
- Called if the mouse is down.
-
mouseEnter(Event, int, int)
- Called when the mouse enters the component.
-
mouseExit(Event, int, int)
- Called when the mouse exits the component.
-
mouseUp(Event, int, int)
- Called if the mouse is up.
-
paint(Graphics)
- Paint the key.
-
setActiveColor(Color)
- Set active color for the key.
-
setDeactiveColor(Color)
- Set deactive color for the key.
-
setMessageLabel(Label)
- Set message label for the key.
-
shift()
- Shift the key.
-
update(Graphics)
- Updates the component, called with a repaint().
name
public String name
- Name of the key.
key
public String key
- Key in normal state.
keyMsg
public String keyMsg
- Information about the key in normal state.
shiftkey
public String shiftkey
- Key in shifted state.
shiftkeyMsg
public String shiftkeyMsg
- Information about the key in shifted state.
Key
public Key(String nm,
String str1,
String str1msg,
String str2,
String str2msg,
Label ml)
- Create a key with a name,
normal key string, information about normal key string,
shifted key string, information about shifted key string,
and a message label.
If shifted key string is null, then the key does not have shifted mode.
setActiveColor
public void setActiveColor(Color c)
- Set active color for the key.
setDeactiveColor
public void setDeactiveColor(Color c)
- Set deactive color for the key.
setMessageLabel
public void setMessageLabel(Label ml)
- Set message label for the key.
key
public String key()
- Return the current meaning of the key.
shift
public void shift()
- Shift the key.
enable
public void enable()
- Enable the key.
- Overrides:
- enable in class Component
disable
public void disable()
- Disable the key.
- Overrides:
- disable in class Component
action
public boolean action(Event evt,
Object arg)
- Called if an action occurs in the Component.
This is to be overwritten to provide callbacks to the key,
or the action can be caught by the parent.
- Overrides:
- action in class Component
mouseEnter
public boolean mouseEnter(Event evt,
int x,
int y)
- Called when the mouse enters the component.
Default behaviour will provide a highlight outlook, and will also
update the message in the message label, if it is set.
- Overrides:
- mouseEnter in class Component
mouseExit
public boolean mouseExit(Event evt,
int x,
int y)
- Called when the mouse exits the component.
Default behaviour will lose the highlight.
- Overrides:
- mouseExit in class Component
mouseDown
public boolean mouseDown(Event evt,
int x,
int y)
- Called if the mouse is down.
Default behaviour will provide a button press outlook.
- Overrides:
- mouseDown in class Component
mouseUp
public boolean mouseUp(Event evt,
int x,
int y)
- Called if the mouse is up.
Default behaviour will provide a button release outlook,
and will deliver a ACTION event if the mouse is within the key.
- Overrides:
- mouseUp in class Component
update
public synchronized void update(Graphics g)
- Updates the component, called with a repaint().
- Overrides:
- update in class Component
paint
public synchronized void paint(Graphics g)
- Paint the key.
- Overrides:
- paint in class Canvas
All Packages Class Hierarchy This Package Previous Next Index