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); }
private void doDraw(GFX g, Node node) { String text = "Welcome to Bedrock"; String text2 = "by josh marinacci"; g.drawImage(image, 0, 0); Stage s = node.getParent().getStage(); double x = 0; double y = 0; x = (s.getWidth() - font.getWidth(text)) / 2; y = (s.getHeight() / 2) - font.getDescender(); g.setPaint(FlatColor.BLACK); g.drawText(text, font, x + 4, y + 4); g.setPaint(FlatColor.WHITE); g.drawText(text, font, x, y); x = (s.getWidth() - font2.getWidth(text2)) / 2; y = y + font2.getAscender() + font2.getDescender(); g.setPaint(FlatColor.BLACK); g.drawText(text2, font2, x + 4, y + 4); g.setPaint(FlatColor.WHITE); g.drawText(text2, font2, x, y); }