public void show(Node node, double x, double y) { if (sharedContextMenu != null) { sharedContextMenu.setVisible(false); sharedLayer.remove(sharedContextMenu); } Stage stage = node.getParent().getStage(); sharedLayer = stage.getPopupLayer(); Point2D pt = NodeUtils.convertToScene(node, x, y); pt = NodeUtils.convertFromScene(sharedLayer, pt); setTranslateX(pt.getX() + 2); setTranslateY(pt.getY()); setVisible(true); sharedContextMenu = this; sharedLayer.add(this); }
public static void hideAll() { if (sharedContextMenu != null) { sharedContextMenu.setVisible(false); sharedLayer.remove(sharedContextMenu); } }