extra.ui
Class BigNumber
java.lang.Object
|
+--waba.ui.Control
|
+--extra.ui.BigNumber
- All Implemented Interfaces:
- PreferredSize
- public class BigNumber
- extends Control
- implements PreferredSize
This is a basic eight segment number display control which can be scaled to any size.
|
Constructor Summary |
BigNumber()
Construct a new number initialised to 0 with DIRECT changing |
BigNumber(int num)
Construct a new number with DIRECT changing |
BigNumber(int num,
int mode)
Construct a new number with the given options |
| Methods inherited from class waba.ui.Control |
addTimer, contains, createGraphics, getFontMetrics, getNext, getParent, getRect, postEvent, removeTimer, repaint, setRect |
DOLLAR
public static final int DOLLAR
POINT
public static final int POINT
DIRECT
public static final int DIRECT
UP_DOWN
public static final int UP_DOWN
NONE
public static final int NONE
BigNumber
public BigNumber()
- Construct a new number initialised to 0 with DIRECT changing
BigNumber
public BigNumber(int num)
- Construct a new number with DIRECT changing
BigNumber
public BigNumber(int num,
int mode)
- Construct a new number with the given options
- Parameters:
num - the value to start withmode - the mode to use
setNumber
public void setNumber(int num)
- Sets the value of this number
- Parameters:
num - 0-9, DOLLAR (for $) or POINT (for .)
setMode
public void setMode(int mode)
- Sets the mode of changing this number.
Possible values are:
- DIRECT - value is determined by the y position clicked - top is 0, bottom is 9, the rest evently divided between
- UP_DOWN - value is increased by one if clicked in the top half, decreased by one in the bottom half
- NONE - this number cannot change
- Parameters:
mode - the mode
getNumber
public int getNumber()
- Gets the value of the number
getPreferredWidth
public int getPreferredWidth(FontMetrics fm)
- Specified by:
getPreferredWidth in interface PreferredSize
getPreferredHeight
public int getPreferredHeight(FontMetrics fm)
- Specified by:
getPreferredHeight in interface PreferredSize
onPaint
public void onPaint(Graphics g)
- Description copied from class:
Control
- Called to draw the control. When this method is called, the graphics
object passed has been translated into the coordinate system of the
control and the area behind the control has
already been painted. The background is painted by the top-level
window control.
- Overrides:
onPaint in class Control
- Following copied from class:
waba.ui.Control
- Parameters:
g - the graphics object for drawing- See Also:
Graphics
onEvent
public void onEvent(Event event)
- Process pen and key events to this component
- Overrides:
onEvent in class Control
- Parameters:
event - the event to process