public abstract class ComponentBase extends java.lang.Object implements IComponent
Modifier and Type | Field and Description |
---|---|
protected ILabeled |
label
The label of the component.
|
Constructor and Description |
---|
ComponentBase(ILabeled label)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
enter()
Should be called by the parent when the component is shown.
|
void |
exit()
Should be called by the parent when the component is hidden.
|
protected abstract int |
getHeight()
Return height of component.
|
void |
getHeight(Context context)
Get the current height via
Context.setHeight(int) . |
java.lang.String |
getTitle()
Get the caption of the component.
|
void |
handleButton(Context context,
int button)
Should be called by the parent when a mouse button state changes.
|
void |
handleChar(Context context,
char character)
Should be called by the parent when a key is typed.
|
void |
handleKey(Context context,
int scancode)
Should be called by the parent when a key is typed.
|
void |
handleScroll(Context context,
int diff)
Should be called by the parent when the mouse wheel is scrolled.
|
boolean |
isVisible()
Check if component should be visible.
|
void |
render(Context context)
Redraw component on screen.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
releaseFocus
protected final ILabeled label
public ComponentBase(ILabeled label)
label
- the label for the componentpublic java.lang.String getTitle()
IComponent
getTitle
in interface IComponent
public void render(Context context)
IComponent
Context.setHeight(int)
.render
in interface IComponent
context
- the Context
for the componentpublic void handleButton(Context context, int button)
IComponent
Context.setHeight(int)
.handleButton
in interface IComponent
context
- the Context
for the componentbutton
- the button that changed its stateIInterface.LBUTTON
,
IInterface.RBUTTON
public void handleKey(Context context, int scancode)
IComponent
Context.setHeight(int)
.handleKey
in interface IComponent
context
- the Context
for the componentscancode
- the scancode for the key that was typedpublic void handleChar(Context context, char character)
IComponent
Context.setHeight(int)
.handleChar
in interface IComponent
context
- the Context
for the componentcharacter
- the character that was typedpublic void handleScroll(Context context, int diff)
IComponent
Context.setHeight(int)
.handleScroll
in interface IComponent
context
- the Context
for the componentdiff
- the amount by which the wheel was movedpublic void getHeight(Context context)
IComponent
Context.setHeight(int)
.getHeight
in interface IComponent
context
- the Context
for the componentpublic void enter()
IComponent
enter
in interface IComponent
public void exit()
IComponent
exit
in interface IComponent
public boolean isVisible()
IComponent
isVisible
in interface IComponent
protected abstract int getHeight()