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

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


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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 com.sun.javafx.css.converters.BooleanConverter;
  29 
  30 import java.util.ArrayList;
  31 import java.util.Collections;
  32 import java.util.List;
  33 
  34 import javafx.beans.DefaultProperty;
  35 import javafx.beans.property.BooleanProperty;
  36 import javafx.beans.value.ObservableValue;
  37 import javafx.beans.value.WritableValue;
  38 import javafx.collections.FXCollections;
  39 import javafx.collections.ObservableList;
  40 import javafx.css.CssMetaData;
  41 import javafx.css.StyleableBooleanProperty;
  42 
  43 import com.sun.javafx.scene.control.skin.MenuBarSkin;
  44 
  45 import javafx.css.Styleable;
  46 import javafx.css.StyleableProperty;
  47 import javafx.scene.AccessibleRole;
  48 
  49 /**
  50  * <p>
  51  * A MenuBar control traditionally is placed at the very top of the user
  52  * interface, and embedded within it are {@link Menu Menus}. To add a menu to
  53  * a menubar, you add it to the {@link #getMenus() menus} ObservableList.
  54  * By default, for each menu added to the menubar, it will be
  55  * represented as a button with the Menu {@link MenuItem#textProperty() text} value displayed.
  56  * <p>
  57  * MenuBar sets focusTraversable to false.
  58  * </p>
  59  *
  60  * To create and populate a {@code MenuBar}, you may do what is shown below.
  61  * Please refer to the {@link Menu} API page for more information on how to
  62  * configure it.
  63  * <pre><code>




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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.converter.BooleanConverter;
  29 
  30 import java.util.ArrayList;
  31 import java.util.Collections;
  32 import java.util.List;
  33 
  34 import javafx.beans.DefaultProperty;
  35 import javafx.beans.property.BooleanProperty;
  36 import javafx.beans.value.ObservableValue;
  37 import javafx.beans.value.WritableValue;
  38 import javafx.collections.FXCollections;
  39 import javafx.collections.ObservableList;
  40 import javafx.css.CssMetaData;
  41 import javafx.css.StyleableBooleanProperty;
  42 
  43 import javafx.scene.control.skin.MenuBarSkin;
  44 
  45 import javafx.css.Styleable;
  46 import javafx.css.StyleableProperty;
  47 import javafx.scene.AccessibleRole;
  48 
  49 /**
  50  * <p>
  51  * A MenuBar control traditionally is placed at the very top of the user
  52  * interface, and embedded within it are {@link Menu Menus}. To add a menu to
  53  * a menubar, you add it to the {@link #getMenus() menus} ObservableList.
  54  * By default, for each menu added to the menubar, it will be
  55  * represented as a button with the Menu {@link MenuItem#textProperty() text} value displayed.
  56  * <p>
  57  * MenuBar sets focusTraversable to false.
  58  * </p>
  59  *
  60  * To create and populate a {@code MenuBar}, you may do what is shown below.
  61  * Please refer to the {@link Menu} API page for more information on how to
  62  * configure it.
  63  * <pre><code>