com.threerings.opengl.gui
Class MenuItem

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.TextComponent
          extended by com.threerings.opengl.gui.Label
              extended by com.threerings.opengl.gui.MenuItem
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, UIConstants

public class MenuItem
extends Label

Displays a single menu item.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.opengl.gui.Label
Label.Fit
 
Field Summary
 
Fields inherited from class com.threerings.opengl.gui.Component
DEFAULT, DISABLED, HOVER
 
Fields inherited from interface com.threerings.opengl.gui.UIConstants
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL
 
Constructor Summary
MenuItem(GlContext ctx, Icon icon, String action)
          Creates a menu item with the specified icon that will generate an ActionEvent with the specified action when selected.
MenuItem(GlContext ctx, String text, Icon icon, String action)
          Creates a menu item with the specified text and icon that will generate an ActionEvent with the specified action when selected.
MenuItem(GlContext ctx, String text, Icon icon, String action, Object argument)
          Creates a menu item with the specified text and icon that will generate an ActionEvent with the specified action and argument when selected.
MenuItem(GlContext ctx, String text, String action)
          Creates a menu item with the specified text that will generate an ActionEvent with the specified action when selected.
 
Method Summary
 boolean dispatchEvent(Event event)
          Instructs this component to process the supplied event.
 String getAction()
          Returns the action configured for this menu item.
 Object getArgument()
          Returns the argument of the action for this menu item.
 
Methods inherited from class com.threerings.opengl.gui.Label
getFit, getIcon, getIconTextGap, getLabelRenderer, getText, setFit, setIcon, setIconTextGap, setOrientation, setPreferredWidth, setText, setTextRotation
 
Methods inherited from class com.threerings.opengl.gui.TextComponent
getEffectColor, getEffectSize, getHorizontalAlignment, getLineSpacing, getTextEffect, getTextFactory, getVerticalAlignment
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFocusTarget, getHeight, getHitComponent, getInsets, getParent, getPreferredSize, getProperty, getState, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getX, getY, hasFocus, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, requestFocus, scrollRectToVisible, setAlpha, setBackground, setBounds, setCursor, setEnabled, setHoverable, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuItem

public MenuItem(GlContext ctx,
                String text,
                String action)
Creates a menu item with the specified text that will generate an ActionEvent with the specified action when selected.


MenuItem

public MenuItem(GlContext ctx,
                Icon icon,
                String action)
Creates a menu item with the specified icon that will generate an ActionEvent with the specified action when selected.


MenuItem

public MenuItem(GlContext ctx,
                String text,
                Icon icon,
                String action)
Creates a menu item with the specified text and icon that will generate an ActionEvent with the specified action when selected.


MenuItem

public MenuItem(GlContext ctx,
                String text,
                Icon icon,
                String action,
                Object argument)
Creates a menu item with the specified text and icon that will generate an ActionEvent with the specified action and argument when selected.

Method Detail

getAction

public String getAction()
Returns the action configured for this menu item.


getArgument

public Object getArgument()
Returns the argument of the action for this menu item.


dispatchEvent

public boolean dispatchEvent(Event event)
Description copied from class: Component
Instructs this component to process the supplied event. If the event is not processed, it will be passed up to its parent component for processing. Derived classes should thus only call super.dispatchEvent for events that they did not "consume".

Overrides:
dispatchEvent in class Component
Returns:
true if this event was consumed, false if not.


Copyright © 2011. All Rights Reserved.