本文整理汇总了Java中javafx.scene.image.ImageView.setLayoutY方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setLayoutY方法的具体用法?Java ImageView.setLayoutY怎么用?Java ImageView.setLayoutY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.image.ImageView
的用法示例。
在下文中一共展示了ImageView.setLayoutY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayImg
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public void displayImg(ImageView imgViewPoped, String title) {
Stage popOut = new Stage();
Pane pane = new Pane();
imgViewPoped.setLayoutX(0);
imgViewPoped.setLayoutY(0);
imgViewPoped.fitWidthProperty().bind(pane.widthProperty());
imgViewPoped.fitHeightProperty().bind(pane.heightProperty());
pane.getChildren().add(imgViewPoped);
Scene scene = new Scene(pane, 1280, 900);
popOut.setTitle(title);
popOut.setScene(scene);
popOut.show();
}
示例2: openImage
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void openImage() {
Stage imagStage = new Stage();
Pane pane = new Pane();
ImageView iView = new ImageView(img);
pane.getChildren().add(iView);
iView.setLayoutX(0);
iView.setLayoutY(0);
iView.fitWidthProperty().bind(pane.widthProperty());
iView.fitHeightProperty().bind(pane.heightProperty());
iView.setPreserveRatio(true);
Scene scene = new Scene(pane, 800, 800);
imagStage.setTitle("" + img);
imagStage.setScene(scene);
imagStage.show();
}
示例3: snapshotNode
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void snapshotNode(Scene scene, Node node) {
SnapshotParameters params = new SnapshotParameters();
Bounds layoutBounds = node.getLayoutBounds();
Bounds bounds = node.localToScene(layoutBounds);
if (!(bounds.getWidth() > 0 && bounds.getHeight() > 0)) {
return;
}
params.setViewport(new Rectangle2D(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight()));
WritableImage writable = new WritableImage((int) bounds.getWidth(), (int) bounds.getHeight());
writable = scene.getRoot().snapshot(params, writable);
ImageView imageView = new ImageView(writable);
imageView.getStyleClass().add("snapshot-image");
imageView.setManaged(false);
imageView.setLayoutX(bounds.getMinX());
imageView.setLayoutY(bounds.getMinY());
imageView.setFitWidth(bounds.getWidth());
imageView.setFitHeight(bounds.getHeight());
Region rect = new Region();
rect.getStyleClass().add("snapshot-background");
rect.setLayoutX(bounds.getMinX() - 5);
rect.setLayoutY(bounds.getMinY() - 5);
rect.resize(bounds.getWidth() + 10, bounds.getHeight() + 10);
rect.setManaged(false);
Line line = new Line();
line.setStartX(bounds.getMaxX() + 4);
line.setStartY(bounds.getMaxY() + 4);
line.setEndX(bounds.getMaxX() + 200);
line.setEndY(bounds.getMaxY() + 200);
line.setStroke(imagePattern);
line.setStrokeWidth(5);
line.setManaged(false);
getChildren().addAll(rect, imageView); //, line);
}