/** * show the popup using the default position */ public void show(Node node) { this.show(node, PopupVPosition.TOP, PopupHPosition.LEFT, 0, 0); }
/** * show the popup according to the specified position * * @param vAlign can be TOP/BOTTOM * @param hAlign can be LEFT/RIGHT */ public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign) { this.show(node, vAlign, hAlign, 0, 0); }
/** * init fxml when loaded. */ @PostConstruct public void init() { try { popup = new JFXPopup(FXMLLoader.load(getClass().getResource("/fxml/ui/popup/DemoPopup.fxml"))); } catch (IOException ioExc) { ioExc.printStackTrace(); } burger1.setOnMouseClicked((e) -> popup.show(rippler1, PopupVPosition.TOP, PopupHPosition.LEFT)); burger2.setOnMouseClicked((e) -> popup.show(rippler2, PopupVPosition.TOP, PopupHPosition.RIGHT)); burger3.setOnMouseClicked((e) -> popup.show(rippler3, PopupVPosition.BOTTOM, PopupHPosition.LEFT)); burger4.setOnMouseClicked((e) -> popup.show(rippler4, PopupVPosition.BOTTOM, PopupHPosition.RIGHT)); } }
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()); } }
@Override public void start(Stage primaryStage) throws Exception { JFXHamburger show = new JFXHamburger(); show.setPadding(new Insets(10, 5, 10, 5)); JFXRippler rippler = new JFXRippler(show, RipplerMask.CIRCLE, RipplerPos.BACK); JFXListView<Label> list = new JFXListView<>(); for (int i = 1; i < 5; i++) { list.getItems().add(new Label("Item " + i)); } AnchorPane container = new AnchorPane(); container.getChildren().add(rippler); AnchorPane.setLeftAnchor(rippler, 200.0); AnchorPane.setTopAnchor(rippler, 210.0); StackPane main = new StackPane(); main.getChildren().add(container); JFXPopup popup = new JFXPopup(list); rippler.setOnMouseClicked(e -> popup.show(rippler, PopupVPosition.TOP, PopupHPosition.LEFT)); final Scene scene = new Scene(main, 800, 800); scene.getStylesheets().add(PopupDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.setTitle("JFX Popup Demo"); primaryStage.setScene(scene); primaryStage.setResizable(false); primaryStage.show(); }
/** * 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()); } }
toolbarPopup = new JFXPopup(loader.load()); optionsBurger.setOnMouseClicked(e -> toolbarPopup.show(optionsBurger, PopupVPosition.TOP, PopupHPosition.RIGHT,
/** * show the popup according to the specified position * * @param vAlign can be TOP/BOTTOM * @param hAlign can be LEFT/RIGHT */ public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign) { this.show(node, vAlign, hAlign, 0, 0); }
/** * show the popup using the default position */ public void show(Node node) { this.show(node, PopupVPosition.TOP, PopupHPosition.LEFT, 0, 0); }
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()); } }
@Override public void drawSavedGestureOnCanvas(final TreeItem<String> gestureItem, final int templateIndex) { // Get the specific gesture from dataset (list of 2D points) final List<Vector2D> template = this.recognizer.getGestureDataset(gestureItem.getValue()).get(templateIndex); // Reset the canvas this.getUserCanvasContext().clearRect(0, 0, this.getLiveCanvas().getWidth(), this.getLiveCanvas().getHeight()); // Redraw oval for every point. Now it's a derivative representation for (final Vector2D path : template) { this.getUserCanvasContext().fillOval(-path.getX() + this.getLiveCanvas().getWidth() / 2, path.getY() + this.getLiveCanvas().getHeight() / 2, 10, 10); } // Show the Canvas in a pop up this.getCnavasPopup().show(this.recorderPane); }
/** * 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()); } }
private void initButtons() { // START AND STOP this.startButton.setOnMouseClicked(e -> { if (e.getButton().equals(MouseButton.SECONDARY)) { this.elevationPopup.show(this.startButton); } else { if (this.recognizer.state()) { this.stopSensor(); this.startButton.setTooltip(new Tooltip("Start the sensor")); this.startButton.setGraphic(ViewUtilities.iconSetter(Material.VISIBILITY, IconDim.MEDIUM)); } else { this.startSensor(); this.startButton.setTooltip(new Tooltip("Start the sensor")); this.startButton.setGraphic(ViewUtilities.iconSetter(Material.VISIBILITY_OFF, IconDim.MEDIUM)); } } }); // SAVE BUTTON this.saveSettingsButton.setGraphic(ViewUtilities.iconSetter(Material.SAVE, IconDim.MEDIUM)); JFXDepthManager.setDepth(this.saveSettingsButton, 4); this.saveSettingsButton.setOnAction(t -> this.saveSettings()); }