diff --git a/modules/controls/src/main/java/javafx/scene/control/ContextMenu.java b/modules/controls/src/main/java/javafx/scene/control/ContextMenu.java --- a/modules/controls/src/main/java/javafx/scene/control/ContextMenu.java +++ b/modules/controls/src/main/java/javafx/scene/control/ContextMenu.java @@ -123,6 +123,16 @@ /*************************************************************************** * * + * Fields * + * * + **************************************************************************/ + + private boolean showRelativeToWindow = false; + + + + /*************************************************************************** + * * * Constructors * * * **************************************************************************/ @@ -144,6 +154,8 @@ this.items.addAll(items); } + + /*************************************************************************** * * * Properties * @@ -193,6 +205,15 @@ } } }; + + + + /*************************************************************************** + * * + * Public API * + * * + **************************************************************************/ + /** * The menu items on the context menu. If this ObservableList is modified at * runtime, the ContextMenu will update as expected. @@ -200,31 +221,6 @@ */ public final ObservableList getItems() { return items; } - /** - * @treatAsPrivate implementation detail - * @deprecated This is an internal API that is not intended for use and will be removed in the next version - */ - @Deprecated - private final BooleanProperty impl_showRelativeToWindow = new SimpleBooleanProperty(false); - /** - * @treatAsPrivate implementation detail - */ - public final boolean isImpl_showRelativeToWindow() { return impl_showRelativeToWindow.get(); } - /** - * @treatAsPrivate implementation detail - */ - public final void setImpl_showRelativeToWindow(boolean value) { impl_showRelativeToWindow.set(value); } - /** - * @treatAsPrivate implementation detail - */ - public final BooleanProperty impl_showRelativeToWindowProperty() { return impl_showRelativeToWindow; } - - /*************************************************************************** - * * - * Methods * - * * - **************************************************************************/ - /** * Shows the {@code ContextMenu} relative to the given anchor node, on the side * specified by the {@code hpos} and {@code vpos} parameters, and offset @@ -276,19 +272,6 @@ doShow(anchor, screenX, screenY); } - private void doShow(Node anchor, double screenX, double screenY) { - Event.fireEvent(this, new Event(Menu.ON_SHOWING)); - if(isImpl_showRelativeToWindow()) { - final Scene scene = (anchor == null) ? null : anchor.getScene(); - final Window win = (scene == null) ? null : scene.getWindow(); - if (win == null) return; - super.show(win, screenX, screenY); - } else { - super.show(anchor, screenX, screenY); - } - Event.fireEvent(this, new Event(Menu.ON_SHOWN)); - } - /** * Hides this {@code ContextMenu} and any visible submenus, assuming that when this function * is called that the {@code ContextMenu} was showing. @@ -307,6 +290,32 @@ return new ContextMenuSkin(this); } + + + /*************************************************************************** + * * + * Private Implementation * + * * + **************************************************************************/ + + final boolean isShowRelativeToWindow() { return showRelativeToWindow; } + final void setShowRelativeToWindow(boolean value) { showRelativeToWindow = value; } + + private void doShow(Node anchor, double screenX, double screenY) { + Event.fireEvent(this, new Event(Menu.ON_SHOWING)); + if(isShowRelativeToWindow()) { + final Scene scene = (anchor == null) ? null : anchor.getScene(); + final Window win = (scene == null) ? null : scene.getWindow(); + if (win == null) return; + super.show(win, screenX, screenY); + } else { + super.show(anchor, screenX, screenY); + } + Event.fireEvent(this, new Event(Menu.ON_SHOWN)); + } + + + /*************************************************************************** * * * Stylesheet Handling * diff --git a/modules/controls/src/main/java/javafx/scene/control/Control.java b/modules/controls/src/main/java/javafx/scene/control/Control.java --- a/modules/controls/src/main/java/javafx/scene/control/Control.java +++ b/modules/controls/src/main/java/javafx/scene/control/Control.java @@ -382,7 +382,7 @@ if (ctx != null) { // set this flag so contextmenu show will be relative to parent window not anchor - ctx.setImpl_showRelativeToWindow(true); //RT-15160 + ctx.setShowRelativeToWindow(true); //RT-15160 // if a context menu is set, we need to install any accelerators // belonging to its menu items ASAP into the scene that this