Example #1
0
 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);
 }
Example #2
0
 @Override
 protected void setPressed(boolean pressed) {
   super.setPressed(pressed);
   if (pressed) {
     if (!popupadded) {
       Stage stage = getParent().getStage();
       stage.getPopupLayer().add(popup);
     }
     Point2D pt = NodeUtils.convertToScene(this, 0, getHeight());
     popup.setTranslateX(Math.round(Math.max(pt.getX(), 0)));
     popup.setTranslateY(Math.round(Math.max(pt.getY(), 0)));
     popup.setVisible(true);
     EventBus.getSystem().setPressedNode(popup);
   } else {
     // popup.setVisible(false);
   }
 }