/** * close the dialog */ public void close() { if (animation != null) { animation.setRate(-1); animation.play(); animation.setOnFinished(e -> { closeDialog(); }); } else { setOpacity(0); setVisible(false); closeDialog(); } }
private void showDialog() { if (dialogContainer == null) { throw new RuntimeException("ERROR: JFXDialog container is not set!"); } if (isCacheContainer()) { tempContent = new ArrayList<>(dialogContainer.getChildren()); SnapshotParameters snapShotparams = new SnapshotParameters(); snapShotparams.setFill(Color.TRANSPARENT); WritableImage temp = dialogContainer.snapshot(snapShotparams, new WritableImage((int) dialogContainer.getWidth(), (int) dialogContainer.getHeight())); ImageView tempImage = new ImageView(temp); tempImage.setCache(true); tempImage.setCacheHint(CacheHint.SPEED); dialogContainer.getChildren().setAll(tempImage, this); } else { //prevent error if opening an already opened dialog dialogContainer.getChildren().remove(this); tempContent = null; dialogContainer.getChildren().add(this); } if (animation != null) { animation.play(); } else { setVisible(true); setOpacity(1); Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.OPENED)); } }
/** * close the dialog */ public void close() { if (animation != null) { animation.setRate(-1); animation.play(); animation.setOnFinished(e -> { closeDialog(); }); } else { setOpacity(0); setVisible(false); closeDialog(); } }
private void showDialog() { if (dialogContainer == null) { throw new RuntimeException("ERROR: JFXDialog container is not set!"); } if (isCacheContainer()) { tempContent = new ArrayList<>(dialogContainer.getChildren()); SnapshotParameters snapShotparams = new SnapshotParameters(); snapShotparams.setFill(Color.TRANSPARENT); WritableImage temp = dialogContainer.snapshot(snapShotparams, new WritableImage((int) dialogContainer.getWidth(), (int) dialogContainer.getHeight())); ImageView tempImage = new ImageView(temp); tempImage.setCache(true); tempImage.setCacheHint(CacheHint.SPEED); dialogContainer.getChildren().setAll(tempImage, this); } else { tempContent = null; dialogContainer.getChildren().add(this); } if (animation != null) { animation.play(); } else { setVisible(true); setOpacity(1); Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.OPENED)); } }