public PreviewCodeAreaBind(CodeArea area) { this.codeArea = area; this.popup = new PopupControl(); this.contentPane = new AnchorPane(); this.canvas = new Canvas(width, height); this.region = new Region(); this.svgPath = new SVGPath(); contentPane.setBorder(LayoutUtil.getSimpleBorder(Color.BLACK, line)); contentPane.setPrefWidth(width + 2 * line); contentPane.setPrefHeight(height + 2 * line); LayoutUtil.setAnchorZero(canvas); LayoutUtil.setAnchorZero(svgPath); LayoutUtil.setAnchorZero(region); region.setPrefSize(width, height); region.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null))); popup.setConsumeAutoHidingEvents(false); popup.setAutoHide(true); popup.setAutoFix(true); popup.setHideOnEscape(true); popup.getScene().setRoot(contentPane); area.setPopupWindow(popup); area.setPopupAlignment(PopupAlignment.CARET_BOTTOM); DragSupport.bind(popup); }
/** * {@inheritDoc} */ @Override protected PopupControl getPopup() { if (popup == null) { super.getPopup(); popup.addEventFilter(KeyEvent.KEY_PRESSED, this::onPopupKeyPressed); } return super.getPopup(); }
public void setPopupControl(PopupControl pc) { this.popupControl = pc; }