modules/controls/src/main/java/javafx/scene/control/MenuButton.java

Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization


  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene.control;
  27 
  28 import javafx.css.PseudoClass;
  29 import javafx.beans.property.ObjectProperty;
  30 import javafx.beans.property.ObjectPropertyBase;
  31 import javafx.collections.FXCollections;
  32 import javafx.collections.ObservableList;
  33 import javafx.event.ActionEvent;
  34 import javafx.event.Event;
  35 import javafx.event.EventType;
  36 import javafx.geometry.Side;
  37 import javafx.scene.AccessibleAction;
  38 import javafx.scene.AccessibleRole;
  39 import javafx.scene.Node;
  40 import com.sun.javafx.scene.control.skin.MenuButtonSkin;
  41 import javafx.beans.property.ReadOnlyBooleanProperty;
  42 import javafx.beans.property.ReadOnlyBooleanWrapper;
  43 
  44 /**
  45  * MenuButton is a button which, when clicked or pressed, will show a
  46  * {@link ContextMenu}. A MenuButton shares a very similar API to the {@link Menu}
  47  * control, insofar that you set the items that should be shown in the
  48  * {@link #items} ObservableList, and there is a {@link #text} property to specify the
  49  * label shown within the MenuButton.
  50  * <p>
  51  * As mentioned, like the Menu API itself, you'll find an {@link #items} ObservableList
  52  * within which you can provide anything that extends from {@link MenuItem}.
  53  * There are several useful subclasses of {@link MenuItem} including
  54  * {@link RadioMenuItem}, {@link CheckMenuItem}, {@link Menu},
  55  * {@link SeparatorMenuItem} and {@link CustomMenuItem}.
  56  * <p>
  57  * A MenuButton can be set to show its menu on any side of the button. This is
  58  * specified using the {@link #popupSideProperty() popupSide} property. By default
  59  * the menu appears below the button. However, regardless of the popupSide specified,
  60  * if there is not enough room, the {@link ContextMenu} will be




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene.control;
  27 
  28 import javafx.css.PseudoClass;
  29 import javafx.beans.property.ObjectProperty;
  30 import javafx.beans.property.ObjectPropertyBase;
  31 import javafx.collections.FXCollections;
  32 import javafx.collections.ObservableList;
  33 import javafx.event.ActionEvent;
  34 import javafx.event.Event;
  35 import javafx.event.EventType;
  36 import javafx.geometry.Side;
  37 import javafx.scene.AccessibleAction;
  38 import javafx.scene.AccessibleRole;
  39 import javafx.scene.Node;
  40 import javafx.scene.control.skin.MenuButtonSkin;
  41 import javafx.beans.property.ReadOnlyBooleanProperty;
  42 import javafx.beans.property.ReadOnlyBooleanWrapper;
  43 
  44 /**
  45  * MenuButton is a button which, when clicked or pressed, will show a
  46  * {@link ContextMenu}. A MenuButton shares a very similar API to the {@link Menu}
  47  * control, insofar that you set the items that should be shown in the
  48  * {@link #items} ObservableList, and there is a {@link #text} property to specify the
  49  * label shown within the MenuButton.
  50  * <p>
  51  * As mentioned, like the Menu API itself, you'll find an {@link #items} ObservableList
  52  * within which you can provide anything that extends from {@link MenuItem}.
  53  * There are several useful subclasses of {@link MenuItem} including
  54  * {@link RadioMenuItem}, {@link CheckMenuItem}, {@link Menu},
  55  * {@link SeparatorMenuItem} and {@link CustomMenuItem}.
  56  * <p>
  57  * A MenuButton can be set to show its menu on any side of the button. This is
  58  * specified using the {@link #popupSideProperty() popupSide} property. By default
  59  * the menu appears below the button. However, regardless of the popupSide specified,
  60  * if there is not enough room, the {@link ContextMenu} will be