Java Code Examples for javafx.scene.layout.StackPane#setVisible()
The following examples show how to use
javafx.scene.layout.StackPane#setVisible() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Pin.java From BlockMap with MIT License | 6 votes |
/** * Wrap a given Node (e.g. a Pin button) in a {@link StackPane} to be placed on to the map. Applies a scaling function (used to scales it * relative to the current zoom factor) and translations (to keep it at a given world space position and centered). */ static StackPane wrapGui(Node node, Vector2dc position, DoubleBinding scale, DisplayViewport viewport) { StackPane stack = new StackPane(node); Translate center = new Translate(); center.xProperty().bind(stack.widthProperty().multiply(-0.5)); center.yProperty().bind(stack.heightProperty().multiply(-0.5)); if (position != null) stack.getTransforms().add(new Translate(position.x(), position.y())); if (scale != null) { Scale scaleTransform = new Scale(); scaleTransform.xProperty().bind(scale); scaleTransform.yProperty().bind(scale); stack.getTransforms().add(scaleTransform); } stack.getTransforms().add(center); stack.setVisible(false); stack.setPickOnBounds(false); stack.setOpacity(0.0); return stack; }
Example 2
Source File: SkinAction.java From DashboardFx with GNU General Public License v3.0 | 6 votes |
private void config(){ button = new StackPane(); button.getStyleClass().setAll("action-button"); button.setFocusTraversable(false); graphic = new Region(); graphic.getStyleClass().setAll("action-button-graphic"); graphic.setFocusTraversable(false); button.setMinWidth(0D); button.setVisible(false); button.getChildren().add(graphic); ((Pane) getChildren().get(0)).getChildren().add(button); }
Example 3
Source File: SmoothedChart.java From OEE-Designer with MIT License | 5 votes |
public void setSymbolsVisible(final XYChart.Series<X, Y> SERIES, final boolean VISIBLE) { if (!getData().contains(SERIES)) { return; } for (XYChart.Data<X, Y> data : SERIES.getData()) { StackPane stackPane = (StackPane) data.getNode(); if (null == stackPane) { continue; } stackPane.setVisible(VISIBLE); } }
Example 4
Source File: ImageGroupDrawer.java From Quelea with GNU General Public License v3.0 | 5 votes |
@Override public void draw(Displayable displayable) { clear(); if(getCanvas().getPlayVideo()) { VLCWindow.INSTANCE.stop(); } imageView = getCanvas().getNewImageView(); imageView.setFitWidth(getCanvas().getWidth()); if(getCanvas().isStageView()) { image = Utils.getImageFromColour(QueleaProperties.get().getStageBackgroundColor()); } else { image = ((ImageDisplayable) displayable).getImage(); imageView.setPreserveRatio(true); } imageView.setImage(image); StackPane imageBox = new StackPane(); imageBox.getChildren().add(imageView); if(getCanvas() != QueleaApp.get().getProjectionWindow().getCanvas() && getCanvas() != QueleaApp.get().getStageWindow().getCanvas()) { imageBox.setStyle("-fx-background-color:#dddddd;"); } imageBox.setVisible(false); getCanvas().getChildren().add(imageBox); getCanvas().pushLogoNoticeToFront(); imageBox.setVisible(true); getCanvas().setOpacity(1); }
Example 5
Source File: PdfDrawer.java From Quelea with GNU General Public License v3.0 | 5 votes |
@Override public void draw(Displayable displayable) { clear(); if(getCanvas().getPlayVideo()) { VLCWindow.INSTANCE.stop(); } imageView = getCanvas().getNewImageView(); imageView.setFitWidth(getCanvas().getWidth()); if(getCanvas().isStageView()) { image = Utils.getImageFromColour(QueleaProperties.get().getStageBackgroundColor()); } else { image = ((ImageDisplayable) displayable).getImage(); imageView.setPreserveRatio(true); } imageView.setImage(image); StackPane imageBox = new StackPane(); imageBox.getChildren().add(imageView); if(getCanvas() != QueleaApp.get().getProjectionWindow().getCanvas() && getCanvas() != QueleaApp.get().getStageWindow().getCanvas()) { imageBox.setStyle("-fx-background-color:#dddddd;"); } imageBox.setVisible(false); getCanvas().getChildren().add(imageBox); getCanvas().pushLogoNoticeToFront(); imageBox.setVisible(true); getCanvas().setOpacity(1); }
Example 6
Source File: ImageDrawer.java From Quelea with GNU General Public License v3.0 | 5 votes |
@Override public void draw(Displayable displayable) { clear(); if(getCanvas().getPlayVideo()) { VLCWindow.INSTANCE.stop(); } imageView = getCanvas().getNewImageView(); imageView.setFitWidth(getCanvas().getWidth()); if(getCanvas().isStageView()) { image = Utils.getImageFromColour(QueleaProperties.get().getStageBackgroundColor()); } else { image = ((ImageDisplayable) displayable).getImage(); imageView.setPreserveRatio(true); } imageView.setImage(image); StackPane imageBox = new StackPane(); imageBox.getChildren().add(imageView); if(getCanvas() != QueleaApp.get().getProjectionWindow().getCanvas() && getCanvas() != QueleaApp.get().getStageWindow().getCanvas()) { imageBox.setStyle("-fx-background-color:#dddddd;"); } imageBox.setVisible(false); getCanvas().getChildren().add(imageBox); getCanvas().pushLogoNoticeToFront(); imageBox.setVisible(true); getCanvas().setOpacity(1); }
Example 7
Source File: SmoothedChart.java From tilesfx with Apache License 2.0 | 5 votes |
public void setSymbolsVisible(final XYChart.Series<X, Y> SERIES, final boolean VISIBLE) { if (!getData().contains(SERIES)) { return; } for (XYChart.Data<X, Y> data : SERIES.getData()) { StackPane stackPane = (StackPane) data.getNode(); if (null == stackPane) { continue; } stackPane.setVisible(VISIBLE); } }
Example 8
Source File: CircularProgressIndicator.java From mars-sim with GNU General Public License v3.0 | 4 votes |
private void initGraphics() { double center = PREFERRED_WIDTH * 0.5; double radius = PREFERRED_WIDTH * 0.45; circle = new Circle(); circle.setCenterX(center); circle.setCenterY(center); circle.setRadius(radius); circle.getStyleClass().add("indicator"); circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE); circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316); circle.setStrokeDashOffset(dashOffset.get()); circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d); arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress()); arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE); arc.setStrokeWidth(PREFERRED_WIDTH * 0.1); arc.getStyleClass().add("indicator"); indeterminatePane = new StackPane(circle); indeterminatePane.setVisible(false); progressPane = new Pane(arc); progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0); getChildren().setAll(progressPane, indeterminatePane); // Setup timeline animation KeyValue kvDashOffset_0 = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH); KeyValue kvDashOffset_50 = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH); KeyValue kvDashOffset_100 = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH); KeyValue kvDashArray_0_0 = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH); KeyValue kvDashArray_0_50 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH); KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH); KeyValue kvRotate_0 = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR); KeyValue kvRotate_100 = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR); KeyFrame kf0 = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0); KeyFrame kf1 = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50); KeyFrame kf2 = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100); timeline.setCycleCount(Animation.INDEFINITE); timeline.getKeyFrames().setAll(kf0, kf1, kf2); // Setup additional pane rotation indeterminatePaneRotation = new RotateTransition(); indeterminatePaneRotation.setNode(indeterminatePane); indeterminatePaneRotation.setFromAngle(0); indeterminatePaneRotation.setToAngle(-360); indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR); indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE); indeterminatePaneRotation.setDuration(new Duration(4500)); }
Example 9
Source File: CircularProgressIndicator.java From mars-sim with GNU General Public License v3.0 | 4 votes |
private void initGraphics() { double center = PREFERRED_WIDTH * 0.5; double radius = PREFERRED_WIDTH * 0.45; circle = new Circle(); circle.setCenterX(center); circle.setCenterY(center); circle.setRadius(radius); circle.getStyleClass().add("indicator"); circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE); circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316); circle.setStrokeDashOffset(dashOffset.get()); circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d); arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress()); arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE); arc.setStrokeWidth(PREFERRED_WIDTH * 0.1); arc.getStyleClass().add("indicator"); indeterminatePane = new StackPane(circle); indeterminatePane.setVisible(false); progressPane = new Pane(arc); progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0); getChildren().setAll(progressPane, indeterminatePane); // Setup timeline animation KeyValue kvDashOffset_0 = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH); KeyValue kvDashOffset_50 = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH); KeyValue kvDashOffset_100 = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH); KeyValue kvDashArray_0_0 = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH); KeyValue kvDashArray_0_50 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH); KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH); KeyValue kvRotate_0 = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR); KeyValue kvRotate_100 = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR); KeyFrame kf0 = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0); KeyFrame kf1 = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50); KeyFrame kf2 = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100); timeline.setCycleCount(Animation.INDEFINITE); timeline.getKeyFrames().setAll(kf0, kf1, kf2); // Setup additional pane rotation indeterminatePaneRotation = new RotateTransition(); indeterminatePaneRotation.setNode(indeterminatePane); indeterminatePaneRotation.setFromAngle(0); indeterminatePaneRotation.setToAngle(-360); indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR); indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE); indeterminatePaneRotation.setDuration(new Duration(4500)); }
Example 10
Source File: JFXSnackbarLayout.java From JFoenix with Apache License 2.0 | 4 votes |
public JFXSnackbarLayout(String message, String actionText, EventHandler<ActionEvent> actionHandler) { initialize(); toast = new Label(); toast.setMinWidth(Control.USE_PREF_SIZE); toast.getStyleClass().add("jfx-snackbar-toast"); toast.setWrapText(true); toast.setText(message); StackPane toastContainer = new StackPane(toast); toastContainer.setPadding(new Insets(20)); actionContainer = new StackPane(); actionContainer.setPadding(new Insets(0, 10, 0, 0)); toast.prefWidthProperty().bind(Bindings.createDoubleBinding(() -> { if (getPrefWidth() == -1) { return getPrefWidth(); } double actionWidth = actionContainer.isVisible() ? actionContainer.getWidth() : 0.0; return prefWidthProperty().get() - actionWidth; }, prefWidthProperty(), actionContainer.widthProperty(), actionContainer.visibleProperty())); setLeft(toastContainer); setRight(actionContainer); if (actionText != null) { action = new JFXButton(); action.setText(actionText); action.setOnAction(actionHandler); action.setMinWidth(Control.USE_PREF_SIZE); action.setButtonType(JFXButton.ButtonType.FLAT); action.getStyleClass().add("jfx-snackbar-action"); // actions will be added upon showing the snackbar if needed actionContainer.getChildren().add(action); if (actionText != null && !actionText.isEmpty()) { action.setVisible(true); actionContainer.setVisible(true); actionContainer.setManaged(true); // to force updating the layout bounds action.setText(""); action.setText(actionText); action.setOnAction(actionHandler); } else { actionContainer.setVisible(false); actionContainer.setManaged(false); action.setVisible(false); } } }