Java Code Examples for javafx.scene.image.ImageView#relocate()
The following examples show how to use
javafx.scene.image.ImageView#relocate() .
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: AnimatedTableRow.java From mars-sim with GNU General Public License v3.0 | 6 votes |
private void moveDataWithAnimation(final TableView<Person> sourceTable, final TableView<Person> destinationTable, final Pane commonTableAncestor, final TableRow<Person> row) { // Create imageview to display snapshot of row: final ImageView imageView = createImageView(row); // Start animation at current row: final Point2D animationStartPoint = row.localToScene(new Point2D(0, 0)); // relative to Scene final Point2D animationEndPoint = computeAnimationEndPoint(destinationTable); // relative to Scene // Set start location final Point2D startInRoot = commonTableAncestor.sceneToLocal(animationStartPoint); // relative to commonTableAncestor imageView.relocate(startInRoot.getX(), startInRoot.getY()); // Create animation final Animation transition = createAndConfigureAnimation( sourceTable, destinationTable, commonTableAncestor, row, imageView, animationStartPoint, animationEndPoint); // add animated image to display commonTableAncestor.getChildren().add(imageView); // start animation transition.play(); }
Example 2
Source File: ZoneSelector.java From AnchorFX with GNU Lesser General Public License v3.0 | 6 votes |
private void buildUI(Image image, double x, double y) { setPrefWidth(image.getWidth()); setPrefHeight(image.getHeight()); iconView = new ImageView(image); setStyle("-fx-background-color:rgba(0,0,0,0);"); iconCircle = new Circle(image.getWidth()/2+10); iconCircle.setCenterX(getPrefWidth() / 2); iconCircle.setCenterY(getPrefHeight() / 2); iconCircle.getStyleClass().add("dockzone-circle-selector"); iconView.relocate((getPrefWidth()-image.getWidth()) / 2, (getPrefWidth()-image.getHeight()) / 2); getChildren().addAll(iconCircle,iconView); parent.getChildren().add(this); relocate(x, y); }
Example 3
Source File: DockUIPanel.java From AnchorFX with GNU Lesser General Public License v3.0 | 4 votes |
private void buildNode(String title, Image iconImage) { Objects.requireNonNull(iconImage); Objects.requireNonNull(title); barPanel = new Pane(); String titleBarStyle = (!subStationStype) ? "docknode-title-bar" : "substation-title-bar"; barPanel.getStyleClass().add(titleBarStyle); barPanel.setPrefHeight(BAR_HEIGHT); barPanel.relocate(0, 0); barPanel.prefWidthProperty().bind(widthProperty()); titleLabel = new Label(title); String titleTextStyle = (!subStationStype) ? "docknode-title-text" : "substation-title-text"; iconView = new ImageView(iconImage); iconView.setFitWidth(15); iconView.setFitHeight(15); iconView.setPreserveRatio(false); iconView.setSmooth(true); iconView.relocate(1,(BAR_HEIGHT-iconView.getFitHeight()) / 2); titleLabel.getStyleClass().add(titleTextStyle); barPanel.getChildren().addAll(iconView,titleLabel); titleLabel.relocate(25, 5); contentPanel = new StackPane(); contentPanel.getStyleClass().add("docknode-content-panel"); contentPanel.relocate(0, BAR_HEIGHT); contentPanel.prefWidthProperty().bind(widthProperty()); contentPanel.prefHeightProperty().bind(heightProperty().subtract(BAR_HEIGHT)); contentPanel.getChildren().add(nodeContent); contentPanel.setCache(true); contentPanel.setCacheHint(CacheHint.SPEED); if (nodeContent instanceof Pane) { Pane nodeContentPane = (Pane)nodeContent; nodeContentPane.setMinHeight(USE_COMPUTED_SIZE); nodeContentPane.setMinWidth(USE_COMPUTED_SIZE); nodeContentPane.setMaxWidth(USE_COMPUTED_SIZE); nodeContentPane.setMaxHeight(USE_COMPUTED_SIZE); } getChildren().addAll(barPanel, contentPanel); }