Package totalcross.ui

Class MenuItem


  • public class MenuItem
    extends java.lang.Object
    This class represents a menu item. It is used in conjunction with the MenuBar and MenuBarDropDown classes.
    Since:
    SuperWaba 5.8
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String caption
      The menu item's caption.
      boolean isChecked
      True if this item is checked.
      boolean isEnabled
      True if this item is enabled, false otherwise.
    • Constructor Summary

      Constructors 
      Constructor Description
      MenuItem()
      Constructs a separator menu item.
      MenuItem​(java.lang.String caption)
      Constructs a menu item with the given caption.
      MenuItem​(java.lang.String caption, boolean isChecked)
      Constructs a menu item with the given caption and the given default state for the check.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isCheckable()
      Returns true if this menu item is checkable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • caption

        public java.lang.String caption
        The menu item's caption.
      • isChecked

        public boolean isChecked
        True if this item is checked. Note that you must use the constructor that specifies the starting state of the check (if set or unset), otherwise changing this will not work.
      • isEnabled

        public boolean isEnabled
        True if this item is enabled, false otherwise.
    • Constructor Detail

      • MenuItem

        public MenuItem()
        Constructs a separator menu item.
      • MenuItem

        public MenuItem​(java.lang.String caption)
        Constructs a menu item with the given caption. This item CANNOT be checked (to allow that, use the other constructor with 2 parameters), but can be enabled/disabled.
        See Also:
        MenuItem(String, boolean)
      • MenuItem

        public MenuItem​(java.lang.String caption,
                        boolean isChecked)
        Constructs a menu item with the given caption and the given default state for the check. This item CAN be checked and can be enabled/disabled as well.
    • Method Detail

      • isCheckable

        public boolean isCheckable()
        Returns true if this menu item is checkable.