|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.util.InputAdapter org.newdawn.slick.gui.AbstractComponent
public abstract class AbstractComponent
The utility class to handle all the input related gubbins for basic GUI components
Field Summary | |
---|---|
protected GUIContext |
container
The game container |
protected Input |
input
The input we're responding to |
protected java.util.Set |
listeners
Listeners for the component to notify |
Constructor Summary | |
---|---|
AbstractComponent(GUIContext container)
Create a new component |
Method Summary | |
---|---|
void |
addListener(ComponentListener listener)
Add a component listener to be informed when the component sees fit. |
protected void |
consumeEvent()
Consume the event currently being processed |
abstract int |
getHeight()
Get the height of the component |
abstract int |
getWidth()
Get the width of the component |
abstract int |
getX()
Returns the position in the X coordinate |
abstract int |
getY()
Returns the position in the Y coordinate |
boolean |
hasFocus()
Check if this component currently has focus |
void |
mouseReleased(int button,
int x,
int y)
Gives the focus to this component with a click of the mouse. |
protected void |
notifyListeners()
Notify all the listeners. |
void |
removeListener(ComponentListener listener)
Remove a component listener. |
abstract void |
render(GUIContext container,
Graphics g)
Render this component to the screen |
void |
setFocus(boolean focus)
Indicate whether this component should be focused or not |
abstract void |
setLocation(int x,
int y)
Moves the component. |
Methods inherited from class org.newdawn.slick.util.InputAdapter |
---|
controllerButtonPressed, controllerButtonReleased, controllerDownPressed, controllerDownReleased, controllerLeftPressed, controllerLeftReleased, controllerRightPressed, controllerRightReleased, controllerUpPressed, controllerUpReleased, inputEnded, inputStarted, isAcceptingInput, keyPressed, keyReleased, mouseClicked, mouseDragged, mouseMoved, mousePressed, mouseWheelMoved, setAcceptingInput, setInput |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected GUIContext container
protected java.util.Set listeners
protected Input input
Constructor Detail |
---|
public AbstractComponent(GUIContext container)
container
- The container displaying this componentMethod Detail |
---|
public void addListener(ComponentListener listener)
listener
- listenerpublic void removeListener(ComponentListener listener)
listener
- listenerprotected void notifyListeners()
public abstract void render(GUIContext container, Graphics g) throws SlickException
container
- The container displaying this componentg
- The graphics context used to render to the display
SlickException
- If there has been an error rendering the componentpublic abstract void setLocation(int x, int y)
x
- X coordinatey
- Y coordinatepublic abstract int getX()
public abstract int getY()
public abstract int getWidth()
public abstract int getHeight()
public void setFocus(boolean focus)
focus
- if the component should be focusedpublic boolean hasFocus()
protected void consumeEvent()
public void mouseReleased(int button, int x, int y)
mouseReleased
in interface MouseListener
mouseReleased
in class InputAdapter
button
- The index of the button (starting at 0)x
- The x position of the mouse when the button was releasedy
- The y position of the mouse when the button was releasedmouseReleased(int, int, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |