|
||||||||||
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 org.newdawn.slick.gui.MouseOverArea
public class MouseOverArea
A mouse over area that can be used for menus or buttons
Field Summary |
---|
Fields inherited from class org.newdawn.slick.gui.AbstractComponent |
---|
container, input, listeners |
Constructor Summary | |
---|---|
MouseOverArea(GUIContext container,
Image image,
int x,
int y)
Create a new mouse over area |
|
MouseOverArea(GUIContext container,
Image image,
int x,
int y,
ComponentListener listener)
Create a new mouse over area |
|
MouseOverArea(GUIContext container,
Image image,
int x,
int y,
int width,
int height)
Create a new mouse over area |
|
MouseOverArea(GUIContext container,
Image image,
int x,
int y,
int width,
int height,
ComponentListener listener)
Create a new mouse over area |
|
MouseOverArea(GUIContext container,
Image image,
Shape shape)
Create a new mouse over area |
Method Summary | |
---|---|
int |
getHeight()
Get the height of the component |
int |
getWidth()
Get the width of the component |
int |
getX()
Returns the position in the X coordinate |
int |
getY()
Returns the position in the Y coordinate |
boolean |
isMouseOver()
Check if the mouse is over this area |
void |
mouseDragged(int oldx,
int oldy,
int newx,
int newy)
Notification that mouse cursor was dragged |
void |
mouseMoved(int oldx,
int oldy,
int newx,
int newy)
Notification that mouse cursor was moved |
void |
mousePressed(int button,
int mx,
int my)
Notification that a mouse button was pressed |
void |
mouseReleased(int button,
int mx,
int my)
Gives the focus to this component with a click of the mouse. |
void |
render(GUIContext container,
Graphics g)
Render this component to the screen |
void |
setLocation(float x,
float y)
Moves the component. |
void |
setLocation(int x,
int y)
Set the location of this area |
void |
setMouseDownColor(Color color)
Set the color to be used when the mouse is down the area |
void |
setMouseDownImage(Image image)
Set the image to be used when the mouse is down the area |
void |
setMouseDownSound(Sound sound)
Set the mouse down sound effect |
void |
setMouseOverColor(Color color)
Set the color to be used when the mouse is over the area |
void |
setMouseOverImage(Image image)
Set the image to be used when the mouse is over the area |
void |
setMouseOverSound(Sound sound)
Set the mouse over sound effect |
void |
setNormalColor(Color color)
Set the normal color used on the image in the default state |
void |
setNormalImage(Image image)
Set the normal image used on the image in the default state |
void |
setX(float x)
Set the x coordinate of this area |
void |
setY(float y)
Set the y coordinate of this area |
Methods inherited from class org.newdawn.slick.gui.AbstractComponent |
---|
addListener, consumeEvent, hasFocus, notifyListeners, removeListener, setFocus |
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, mouseWheelMoved, setAcceptingInput, setInput |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MouseOverArea(GUIContext container, Image image, int x, int y, ComponentListener listener)
container
- The container displaying the mouse over areaimage
- The normalImage to displayx
- The position of the areay
- the position of the arealistener
- A listener to add to the areapublic MouseOverArea(GUIContext container, Image image, int x, int y)
container
- The container displaying the mouse over areaimage
- The normalImage to displayx
- The position of the areay
- the position of the areapublic MouseOverArea(GUIContext container, Image image, int x, int y, int width, int height, ComponentListener listener)
container
- The container displaying the mouse over areaimage
- The normalImage to displayx
- The position of the areay
- the position of the areawidth
- The width of the areaheight
- The height of the arealistener
- A listener to add to the areapublic MouseOverArea(GUIContext container, Image image, int x, int y, int width, int height)
container
- The container displaying the mouse over areaimage
- The normalImage to displayx
- The position of the areay
- the position of the areawidth
- The width of the areaheight
- The height of the areapublic MouseOverArea(GUIContext container, Image image, Shape shape)
container
- The container displaying the mouse over areaimage
- The normalImage to displayshape
- The shape defining the area of the mouse sensitive zoneMethod Detail |
---|
public void setLocation(float x, float y)
x
- X coordinatey
- Y coordinatepublic void setX(float x)
x
- The new x coordinate of this areapublic void setY(float y)
y
- The new y coordinate of this areapublic int getX()
getX
in class AbstractComponent
public int getY()
getY
in class AbstractComponent
public void setNormalColor(Color color)
color
- The color to be usedpublic void setMouseOverColor(Color color)
color
- The color to be used when the mouse is over the areapublic void setMouseDownColor(Color color)
color
- The color to be used when the mouse is down the areapublic void setNormalImage(Image image)
image
- The image to be usedpublic void setMouseOverImage(Image image)
image
- The image to be used when the mouse is over the areapublic void setMouseDownImage(Image image)
image
- The image to be used when the mouse is down the areapublic void render(GUIContext container, Graphics g)
AbstractComponent
render
in class AbstractComponent
container
- The container displaying this componentg
- The graphics context used to render to the displayAbstractComponent.render(org.newdawn.slick.gui.GUIContext,
org.newdawn.slick.Graphics)
public void setMouseOverSound(Sound sound)
sound
- The mouse over sound effectpublic void setMouseDownSound(Sound sound)
sound
- The mouse down sound effectpublic void mouseMoved(int oldx, int oldy, int newx, int newy)
MouseListener
mouseMoved
in interface MouseListener
mouseMoved
in class InputAdapter
oldx
- The old x position of the mouseoldy
- The old y position of the mousenewx
- The new x position of the mousenewy
- The new y position of the mouseInputAdapter.mouseMoved(int, int, int, int)
public void mouseDragged(int oldx, int oldy, int newx, int newy)
MouseListener
mouseDragged
in interface MouseListener
mouseDragged
in class InputAdapter
oldx
- The old x position of the mouseoldy
- The old y position of the mousenewx
- The new x position of the mousenewy
- The new y position of the mouseInputAdapter.mouseDragged(int, int, int, int)
public void mousePressed(int button, int mx, int my)
MouseListener
mousePressed
in interface MouseListener
mousePressed
in class InputAdapter
button
- The index of the button (starting at 0)mx
- The x position of the mouse when the button was pressedmy
- The y position of the mouse when the button was pressedInputAdapter.mousePressed(int, int, int)
public void mouseReleased(int button, int mx, int my)
AbstractComponent
mouseReleased
in interface MouseListener
mouseReleased
in class AbstractComponent
button
- The index of the button (starting at 0)mx
- The x position of the mouse when the button was releasedmy
- The y position of the mouse when the button was releasedInputAdapter.mouseReleased(int, int, int)
public int getHeight()
AbstractComponent
getHeight
in class AbstractComponent
AbstractComponent.getHeight()
public int getWidth()
AbstractComponent
getWidth
in class AbstractComponent
AbstractComponent.getWidth()
public boolean isMouseOver()
public void setLocation(int x, int y)
setLocation
in class AbstractComponent
x
- The x coordinate of this areay
- The y coordiante of this area
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |