|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--waba.ui.Control
Control is the base class for user-interface objects.
| Field Summary | |
static int |
AFTER
Constant used in param x/y in setRect. |
int |
appId
Application defined constant. |
java.lang.Object |
appObj
Application defined object. |
protected Container |
asContainer
Not null if this control is a container |
protected Window |
asWindow
Not null if this control is a window |
protected Color |
backColor
Background color of this control. |
protected Color |
backDis
Disabled fore and back colors |
static int |
BEFORE
Constant used in param x/y in setRect. |
static int |
BOTTOM
Constant used in param y in setRect. |
static int |
CENTER
Constant used in params x and y in setRect. |
int |
clearValueInt
Default value when calling clear. |
java.lang.String |
clearValueStr
Default value when calling clear. |
protected boolean |
enabled
True if the control is enabled (accepts events) or false if not |
static int |
FILL
Constant used in params width and height in setRect. |
static int |
FIT
Constant used in params width and height in setRect. |
FontMetrics |
fm
The fontMetrics corresponding to the controls font. |
protected int |
fmH
Stores the heigh of the current font. |
protected boolean |
focusLess
If true, this control will receive pen and key events but will never gain focus. |
boolean |
focusTraversable
Defines if this control can receive focus by using the arrow keys. |
protected Font |
font
The font used by the control. |
protected Color |
foreColor
Foreground color of this control. |
protected Color |
foreDis
Disabled fore and back colors |
protected int |
height
The control's height |
static int |
highlightRectsCount
Deprecated. Set the UIColors.highlightColors to the colors you want to display on the highlight rectangle. |
protected static boolean |
isHighlighting
If true, the keyboard arrows will be used to highlight the controls until one is selected. |
static int |
LEFT
Constant used in param x in setRect. |
protected Container |
parent
The parent of the control. |
static int |
PREFERRED
Constant used in params width and height in setRect. |
static int |
RANGE
|
static int |
RIGHT
Constant used in param x in setRect. |
static int |
SAME
Constant used in params x/y/width/height in setRect. |
static int |
TOP
Constant used in param y in setRect. |
static boolean |
uiCE
Shortcuts to test the UI style. |
static boolean |
uiFlat
Shortcuts to test the UI style. |
static boolean |
uiPalm
Shortcuts to test the UI style. |
static boolean |
uiVista
Shortcuts to test the UI style. |
protected boolean |
visible
True if the control is visible, false otherwise |
protected int |
width
The control's width |
protected int |
x
The control's x location |
protected int |
x2
x+width-1 |
protected int |
y
The control's y location |
protected int |
y2
y+height-1 |
| Constructor Summary | |
protected |
Control()
creates the font for this control as the same font of the MainWindow. |
| Method Summary | |
Timer |
addTimer(int millis)
Adds a timer to a control. |
void |
changeHighlighted(Container p,
boolean forward)
Transfers the focus to the next or previous control. |
void |
clear()
Placeholder for the clear method. |
boolean |
contains(int x,
int y)
Returns true if the given x and y coordinate in the parent's coordinate system is contained within this control. |
Graphics |
createGraphics()
Creates a Graphics object which can be used to draw in the control. |
void |
drawHighlight()
Draws the highlight rect around the given control. |
Rect |
getAbsoluteRect()
Returns the absolute coordinates of this control relative to the MainWindow. |
Color |
getBackColor()
Get the desired background color of this control. |
Font |
getFont()
Gets the font of this control. |
FontMetrics |
getFontMetrics(Font font)
Deprecated. Use font.fm instead. |
Color |
getForeColor()
Get the desired foreground color of this control. |
Control |
getNext()
Returns the next child in the parent's list of controls. |
Container |
getParent()
Returns the control's parent container. |
Window |
getParentWindow()
Returns the control's parent Window or topMost if there's no parent (eg: the control still not added to any container). |
Coord |
getPos()
Returns the current position (x,y) of this control |
int |
getPreferredHeight()
Returns the preffered height of this control. |
int |
getPreferredWidth()
Returns the preffered width of this control. |
Rect |
getRect()
Returns a copy of the control's rectangle. |
Coord |
getSize()
Returns the current size (width,height) of this control |
boolean |
isDisplayed()
Return true if the parent of this Control is added to somewhere. |
boolean |
isEnabled()
Returns if this control can or not accept events |
boolean |
isVisible()
Returns true if this control is visible, false otherwise |
protected void |
onBoundsChanged()
Called after a setRect. |
protected void |
onColorsChanged(boolean colorsChanged)
Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. |
void |
onEvent(Event event)
Called to process key, pen, control and other posted events. |
protected void |
onFontChanged()
Called after a setFont |
void |
onPaint(Graphics g)
Called to draw the control. |
protected void |
onWindowPaintFinished()
Called after the window has finished a paint. |
void |
postEvent(Event event)
Posts an event. |
boolean |
removeTimer(Timer timer)
Removes a timer from a control. |
void |
repaint()
Marks the control for repaint. |
void |
repaintNow()
Redraws the control immediately. |
void |
requestFocus()
Sets the focus to this control. |
void |
setBackColor(Color c)
Set the background color of this control. |
void |
setBackForeColors(Color back,
Color fore)
Set the background and foreground colors at once |
void |
setEnabled(boolean enabled)
Sets if this control can or not accept events. |
void |
setFocusLess(boolean on)
Sets this control to be focusless. |
void |
setFont(Font font)
sets the font of this control. |
void |
setForeColor(Color c)
Set the foreground color of this control. |
void |
setRect(int x,
int y,
int width,
int height)
Sets or changes a control's position and size. |
void |
setRect(int x,
int y,
int width,
int height,
Control relative)
Sets or changes a control's position and size. |
void |
setRect(Rect r)
Sets or changes a control's position and size. |
void |
setVisible(boolean visible)
Shows or "hides" this control. |
void |
translateFromOrigin(Coord z)
Sets the given Point to the absolute coordinate relative to the origin Window. |
static void |
uiStyleChanged()
Internal use only |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected int x
protected int y
protected int width
protected int height
protected Container parent
protected boolean enabled
protected Font font
public FontMetrics fm
protected boolean visible
protected Color foreColor
protected Color backColor
public int appId
public java.lang.Object appObj
public java.lang.String clearValueStr
public int clearValueInt
public static final int PREFERRED
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int TOP
public static final int BOTTOM
public static final int FILL
public static final int BEFORE
public static final int SAME
public static final int AFTER
public static final int FIT
protected int fmH
fm.getHeight().protected static boolean isHighlighting
public static int highlightRectsCount
public boolean focusTraversable
public static boolean uiPalm
public static boolean uiCE
public static boolean uiFlat
public static boolean uiVista
protected Color foreDis
protected Color backDis
protected int x2
protected int y2
protected boolean focusLess
public static final int RANGE
protected Container asContainer
protected Window asWindow
| Constructor Detail |
protected Control()
| Method Detail |
public Timer addTimer(int millis)
millis - the timer tick interval in millisecondsControlEventpublic boolean removeTimer(Timer timer)
public void setFont(Font font)
public Font getFont()
public int getPreferredWidth()
public int getPreferredHeight()
public FontMetrics getFontMetrics(Font font)
font.fm directly.public void setRect(Rect r)
public void setRect(int x,
int y,
int width,
int height)
add(new Label("1"),CENTER,CENTER);
add(new Label("2"),AFTER,SAME);
add(new Label("3"),SAME,AFTER);
add(new Label("4"),BEFORE,SAME);
add(new Label("5"),BEFORE,BEFORE);
You will see this on screen:
512 43Note: add(control, x,y) does:
add(control); control.setRect(x,y,PREFERRED,PREFERRED);
Important! Always add the control to the container before doing a setRect.
The relative positioning does not work well if the control is placed outside screen bounds.
public void setRect(int x,
int y,
int width,
int height,
Control relative)
Important note: you can't use FILL/FIT with BEFORE/RIGHT/BOTTOM (for x,y).
add(new Label("1"),CENTER,CENTER);
add(new Label("2"),AFTER,SAME);
add(new Label("3"),SAME,AFTER);
add(new Label("4"),BEFORE,SAME);
add(new Label("5"),BEFORE,BEFORE);
You will see this on screen:
512 43Note: add(control, x,y) does:
add(control); control.setRect(x,y,PREFERRED,PREFERRED);
Important! Always add the control to the container before doing a setRect.
The relative positioning does not work well if the control is placed outside screen bounds.
public Coord getSize()
public Coord getPos()
public void setVisible(boolean visible)
public boolean isVisible()
public Rect getRect()
public Rect getAbsoluteRect()
public Window getParentWindow()
public Container getParent()
public Control getNext()
public boolean contains(int x,
int y)
public void repaint()
public void repaintNow()
public void translateFromOrigin(Coord z)
public Graphics createGraphics()
public void postEvent(Event event)
Eventpublic void setEnabled(boolean enabled)
public boolean isEnabled()
public void onEvent(Event event)
event - the event to processEvent,
KeyEvent,
PenEventpublic void onPaint(Graphics g)
g - the graphics object for drawingGraphicsprotected void onBoundsChanged()
protected void onColorsChanged(boolean colorsChanged)
protected void onWindowPaintFinished()
protected void onFontChanged()
public void setBackForeColors(Color back,
Color fore)
public void setForeColor(Color c)
public void setBackColor(Color c)
public Color getForeColor()
public Color getBackColor()
public boolean isDisplayed()
public void requestFocus()
isHighlighting = false.public void setFocusLess(boolean on)
public static void uiStyleChanged()
public void drawHighlight()
public void changeHighlighted(Container p,
boolean forward)
public void clear()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||