< prev index next >

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

Print this page




 122 
 123     /***************************************************************************
 124      *                                                                         *
 125      * Properties                                                              *
 126      *                                                                         *
 127      **************************************************************************/
 128 
 129     /**
 130      * Use the system menu bar if the current platform supports it.
 131      *
 132      * This should not be set on more than one MenuBar instance per
 133      * Stage. If this property is set to true on more than one
 134      * MenuBar in the same Stage, then the last menu set is allowed
 135      * to modify the system menu bar, and if there is an existing installed
 136      * system menu it is unset and removed from the system menu bar.
 137      *
 138      * Note that trying to uni-directionally bind to this property
 139      * will throw a RuntimeException.  Please use
 140      * bi-directional binding to this property instead.
 141      *

 142      * @since JavaFX 2.1
 143      */
 144     public final BooleanProperty useSystemMenuBarProperty() {
 145         if (useSystemMenuBar == null) {
 146             useSystemMenuBar = new StyleableBooleanProperty() {
 147 
 148                 @Override
 149                 public CssMetaData<MenuBar,Boolean> getCssMetaData() {
 150                     return StyleableProperties.USE_SYSTEM_MENU_BAR;
 151                 }
 152 
 153                 @Override
 154                 public Object getBean() {
 155                     return MenuBar.this;
 156                 }
 157 
 158                 @Override
 159                 public String getName() {
 160                     return "useSystemMenuBar";
 161                 }


 173         "cannot uni-directionally bind to the system menu bar - use bindBidrectional instead";
 174 
 175     private BooleanProperty useSystemMenuBar;
 176     public final void setUseSystemMenuBar(boolean value) {
 177         useSystemMenuBarProperty().setValue(value);
 178     }
 179     public final boolean isUseSystemMenuBar() {
 180         return useSystemMenuBar == null ? false : useSystemMenuBar.getValue();
 181     }
 182 
 183 
 184     /***************************************************************************
 185      *                                                                         *
 186      * Public API                                                              *
 187      *                                                                         *
 188      **************************************************************************/
 189 
 190     /**
 191      * The menus to show within this MenuBar. If this ObservableList is modified at
 192      * runtime, the MenuBar will update as expected.

 193      * @see Menu
 194      */
 195     public final ObservableList<Menu> getMenus() {
 196         return menus;
 197     }
 198 
 199     /** {@inheritDoc} */
 200     @Override protected Skin<?> createDefaultSkin() {
 201         return new MenuBarSkin(this);
 202     }
 203 
 204     /***************************************************************************
 205      *                                                                         *
 206      * Stylesheet Handling                                                     *
 207      *                                                                         *
 208      **************************************************************************/
 209 
 210     private static final String DEFAULT_STYLE_CLASS = "menu-bar";
 211 
 212     private static class StyleableProperties {




 122 
 123     /***************************************************************************
 124      *                                                                         *
 125      * Properties                                                              *
 126      *                                                                         *
 127      **************************************************************************/
 128 
 129     /**
 130      * Use the system menu bar if the current platform supports it.
 131      *
 132      * This should not be set on more than one MenuBar instance per
 133      * Stage. If this property is set to true on more than one
 134      * MenuBar in the same Stage, then the last menu set is allowed
 135      * to modify the system menu bar, and if there is an existing installed
 136      * system menu it is unset and removed from the system menu bar.
 137      *
 138      * Note that trying to uni-directionally bind to this property
 139      * will throw a RuntimeException.  Please use
 140      * bi-directional binding to this property instead.
 141      *
 142      * @return the use system menu bar property
 143      * @since JavaFX 2.1
 144      */
 145     public final BooleanProperty useSystemMenuBarProperty() {
 146         if (useSystemMenuBar == null) {
 147             useSystemMenuBar = new StyleableBooleanProperty() {
 148 
 149                 @Override
 150                 public CssMetaData<MenuBar,Boolean> getCssMetaData() {
 151                     return StyleableProperties.USE_SYSTEM_MENU_BAR;
 152                 }
 153 
 154                 @Override
 155                 public Object getBean() {
 156                     return MenuBar.this;
 157                 }
 158 
 159                 @Override
 160                 public String getName() {
 161                     return "useSystemMenuBar";
 162                 }


 174         "cannot uni-directionally bind to the system menu bar - use bindBidrectional instead";
 175 
 176     private BooleanProperty useSystemMenuBar;
 177     public final void setUseSystemMenuBar(boolean value) {
 178         useSystemMenuBarProperty().setValue(value);
 179     }
 180     public final boolean isUseSystemMenuBar() {
 181         return useSystemMenuBar == null ? false : useSystemMenuBar.getValue();
 182     }
 183 
 184 
 185     /***************************************************************************
 186      *                                                                         *
 187      * Public API                                                              *
 188      *                                                                         *
 189      **************************************************************************/
 190 
 191     /**
 192      * The menus to show within this MenuBar. If this ObservableList is modified at
 193      * runtime, the MenuBar will update as expected.
 194      * @return the list of menus to show within this MenuBar
 195      * @see Menu
 196      */
 197     public final ObservableList<Menu> getMenus() {
 198         return menus;
 199     }
 200 
 201     /** {@inheritDoc} */
 202     @Override protected Skin<?> createDefaultSkin() {
 203         return new MenuBarSkin(this);
 204     }
 205 
 206     /***************************************************************************
 207      *                                                                         *
 208      * Stylesheet Handling                                                     *
 209      *                                                                         *
 210      **************************************************************************/
 211 
 212     private static final String DEFAULT_STYLE_CLASS = "menu-bar";
 213 
 214     private static class StyleableProperties {


< prev index next >