java.lang.Objectgreenfoot.Actor
MenuElement
Menu
public class Menu
Menu view and view controller; extends MenuElement.
Field Summary |
---|
Fields inherited from class MenuElement |
---|
active, FONT, frame, image, index, title |
Constructor Summary | |
---|---|
Menu(MenuBarItem menuBarItem,
java.util.ArrayList<java.lang.String> items)
Constructs a Menu. |
Method Summary | |
---|---|
void |
act()
The procedure containing the menu's behaviour. |
protected void |
addedToWorld(greenfoot.World world)
Draws, and activates, the menu when it is added to the world. |
void |
didHoverOverMenuItem(MenuItem menuItem)
Menu behaviour for hovering over a menu item. |
java.util.ArrayList<MenuItem> |
menuItems()
Returns the MenuItems that belongs to the menu. |
void |
setActive(boolean state)
Sets the state of the menu. |
void |
setItems(java.util.ArrayList<java.lang.String> items)
Sets the items of the menu. |
Methods inherited from class MenuElement |
---|
active, frame, index, setFrame |
Methods inherited from class greenfoot.Actor |
---|
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 |
Constructor Detail |
---|
public Menu(MenuBarItem menuBarItem, java.util.ArrayList<java.lang.String> items)
menuBarItem
- The menu bar item that the menu belongs to.items
- The items in the menu (as Strings
)Method Detail |
---|
public void act()
act
in class greenfoot.Actor
protected void addedToWorld(greenfoot.World world)
addedToWorld
in class greenfoot.Actor
World
- The World
the object was added to.public void didHoverOverMenuItem(MenuItem menuItem)
menuItem
- The menu item that the cursor is currently hovering over.public java.util.ArrayList<MenuItem> menuItems()
MenuItems
that belongs to the menu.
MenuItems
belonging to the menu.public void setActive(boolean state)
setActive
in class MenuElement
The
- new state of the menu.public void setItems(java.util.ArrayList<java.lang.String> items)
items
- The titles (as Strings
) of the menu's items.