public void show(Window window, double x, double y, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) { if (!isShowing()) { if (window == null) { throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); } Window parent = window; final double anchorX = parent.getX() + x + initOffsetX; final double anchorY = parent.getY() + y + initOffsetY; this.show(parent, anchorX, anchorY); ((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY); Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate()); } }
/** * show the popup according to the specified position with a certain offset * * @param vAlign can be TOP/BOTTOM * @param hAlign can be LEFT/RIGHT * @param initOffsetX on the x axis * @param initOffsetY on the y axis */ public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) { if (!isShowing()) { if (node.getScene() == null || node.getScene().getWindow() == null) { throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); } Window parent = node.getScene().getWindow(); final Point2D origin = node.localToScene(0, 0); final double anchorX = parent.getX() + origin.getX() + node.getScene().getX() + (hAlign == PopupHPosition.RIGHT ? ((Region) node).getWidth() : 0); final double anchorY = parent.getY() + origin.getY() + node.getScene() .getY() + (vAlign == PopupVPosition.BOTTOM ? ((Region) node).getHeight() : 0); this.show(parent, anchorX, anchorY); ((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY); Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate()); } }
public void show(Window window, double x, double y, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) { if (!isShowing()) { if (window == null) { throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); } Window parent = window; final double anchorX = parent.getX() + x + initOffsetX; final double anchorY = parent.getY() + y + initOffsetY; this.show(parent, anchorX, anchorY); ((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY); Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate()); } }
/** * show the popup according to the specified position with a certain offset * * @param vAlign can be TOP/BOTTOM * @param hAlign can be LEFT/RIGHT * @param initOffsetX on the x axis * @param initOffsetY on the y axis */ public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) { if (!isShowing()) { if (node.getScene() == null || node.getScene().getWindow() == null) { throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); } Window parent = node.getScene().getWindow(); final Point2D origin = node.localToScene(0, 0); final double anchorX = parent.getX() + origin.getX() + node.getScene().getX() + (hAlign == PopupHPosition.RIGHT ? ((Region) node).getWidth() : 0); final double anchorY = parent.getY() + origin.getY() + node.getScene() .getY() + (vAlign == PopupVPosition.BOTTOM ? ((Region) node).getHeight() : 0); this.show(parent, anchorX, anchorY); ((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY); Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate()); } }