本文整理匯總了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);
}