java.lang.Objectgreenfoot.Actor
MenuElement
public abstract class MenuElement
'MenuElement' is an abstract class which provides a partial implementation of a menu UI element
Field Summary | |
---|---|
protected boolean |
active
The element's state. |
protected static java.awt.Font |
FONT
Font used by all menu elements |
protected java.awt.Rectangle |
frame
The element's frame, which includes its origin (in view) and its dimensions. |
protected greenfoot.GreenfootImage |
image
The container for the element's view. |
protected int |
index
The element's index; it's position relative to other elements within the same group. |
protected java.lang.String |
title
The tile of the menu element. |
Constructor Summary | |
---|---|
MenuElement(java.lang.String title,
int index)
Constructs a MenuElement |
Method Summary | |
---|---|
boolean |
active()
Returns the element's state (wether it is active or not). |
java.awt.Rectangle |
frame()
Returns the element's frame. |
int |
index()
Returns the element's index; it's position relative to other elements within the same group. |
void |
setActive(boolean state)
Sets the element's state. |
void |
setFrame(java.awt.Rectangle frame)
Sets the element's frame. |
Methods inherited from class greenfoot.Actor |
---|
act, addedToWorld, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWorld, getX, getY, intersects, move, setImage, setImage, setLocation, setRotation, turn |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean active
protected static final java.awt.Font FONT
protected java.awt.Rectangle frame
protected greenfoot.GreenfootImage image
protected int index
protected java.lang.String title
Constructor Detail |
---|
public MenuElement(java.lang.String title, int index)
title
- The title of the menu element.index
- The position of the menu element, relative to others within the same group.Method Detail |
---|
public boolean active()
public java.awt.Rectangle frame()
Rectangle
), which includes its origin (in view) and its dimensions.Rectangle
public int index()
public void setActive(boolean state)
state
- The element's new state.public void setFrame(java.awt.Rectangle frame)
frame
- The Rectangle
that is to be the new frame to be used by the menu element.