当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.setCache方法代码示例

本文整理汇总了Java中javafx.scene.image.ImageView.setCache方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setCache方法的具体用法?Java ImageView.setCache怎么用?Java ImageView.setCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.image.ImageView的用法示例。


在下文中一共展示了ImageView.setCache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIv

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private ImageView createIv(double x, double y) {
	ImageView iv = new ImageView();
	iv.setImage(image);
	iv.setSmooth(true);
	iv.setPickOnBounds(true);
	iv.setCache(true);
	iv.setX(x);
	iv.setY(y);
	iv.setCursor(Cursor.HAND);
	iv.setOnMouseDragged((t) -> {
		ImageView i = (ImageView) (t.getSource());
		i.setX(t.getSceneX()-size/2);
		i.setY(t.getSceneY()-size/2);
	});
	iv.setOnMouseReleased((t) -> {
		double newX = t.getSceneX();
		double newY = t.getSceneY();
		if(zones.isInZone(newX, newY, type)) {
			iv.setVisible(false);
		}
	});
	return iv;
}
 
开发者ID:clonex10100,项目名称:Dna-replication-game,代码行数:24,代码来源:PrimeZoneActivater.java

示例2: addImageView

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void addImageView(final Image i) {
	try {
		final String imageName = i.getUri().toURL().toString();
		ImageView imageView = new ImageView(new javafx.scene.image.Image(imageName));
		imageView.setSmooth(true);
		imageView.setCache(true);
		imageView.setCacheHint(CacheHint.SPEED);
		imageView.setPreserveRatio(true);
		imageView.setFitWidth(200);

		Platform.runLater(() -> {
			tilePane.getChildren().add(imageView);
		});

	} catch (MalformedURLException e) {
		System.out.println("URL Conversion didn't work");
		e.printStackTrace();
	}
}
 
开发者ID:jakemanning,项目名称:boomer-tuner,代码行数:20,代码来源:ImagesView.java

示例3: createImageView

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private ImageView createImageView(final File imageFile) {

		try {
			final Image img = new Image(new FileInputStream(imageFile), 120, 0, true, true);
			imageView1 = new ImageView(img);

			imageView1.setStyle("-fx-background-color: BLACK");
			imageView1.setFitHeight(120);

			imageView1.setPreserveRatio(true);
			imageView1.setSmooth(true);
			imageView1.setCache(true);

		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		return imageView1;
	}
 
开发者ID:MeAnupSarkar,项目名称:ExoVisix,代码行数:20,代码来源:SampleController.java

示例4: newDir2

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public void newDir2() {
    int j = 0; // Used to properly insert to grid when there are files other than an image
    for (int i=0; i<fileList.length; i++) {
        String path = "" + fileList[i];
        if (fileList[i].getName().contains(".png") || fileList[i].getName().contains(".jpg")||
            fileList[i].getName().contains(".gif") || fileList[i].getName().contains(".jpeg")) {
            String title = "" + fileList[i];
            pth = new Image("file://" + fileList[i]);
            ImageView view = (ImageView) (tilePane.getChildren().get(j));

            view.setImage(pth);
            view.setCache(true);
								    final ImageView imgViewPoped =  new ImageView("file://" + fileList[i]);
            // image click actions
            view.setOnMouseClicked(mouse -> {
                MouseButton button = mouse.getButton();
				            if (mouse.getClickCount() == 2 && button == MouseButton.PRIMARY && !mouse.isConsumed()) {
				                mouse.consume();
                    txtDirPath.setText(path);
                    settings.setBackgroundInfo(path);
   								     } else if (button == MouseButton.SECONDARY) {
			                 displayImg(imgViewPoped, title);
                }
            });
            j++;
				    } else {
               System.out.println("Not an image file.");
        }
    }
}
 
开发者ID:maximstewart,项目名称:UDE,代码行数:31,代码来源:BackgroundMngrController.java

示例5: initialize

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void initialize() {
    imageView = new ImageView();
    imageView.setPreserveRatio(true);
    imageView.setSmooth(true);
    imageView.setCache(true);

    imageViewExt = new ImageViewExt(imageView);

    BorderPane root = new BorderPane(imageView);
    imageView.fitWidthProperty().bind(widthProperty());
    imageView.fitHeightProperty().bind(heightProperty());

    Scene scene = new Scene(root);
    scene.setFill(Color.BLACK);
    setScene(scene);
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:17,代码来源:ImageStage.java

示例6: buildItemCell

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private Node buildItemCell(SocialMediaItem item) {
    HBox hbox = new HBox();
    InputStream resource = item.getClass().getResourceAsStream("icon.png");
    if (resource != null) {
        ImageView sourceImage = new ImageView();
        sourceImage.setFitHeight(18);
        sourceImage.setPreserveRatio(true);
        sourceImage.setSmooth(true);
        sourceImage.setCache(true);
        sourceImage.setImage(new Image(resource));
        hbox.getChildren().add(sourceImage);
    }

    if (item.getImage() != null) {
        HBox picture = new HBox();
        picture.setPadding(new Insets(0, 10, 0, 0));
        ImageView imageView = new ImageView(item.getImage());
        imageView.setPreserveRatio(true);
        imageView.setFitWidth(150);
        picture.getChildren().add(imageView);
        hbox.getChildren().add(picture);
    }

    Label text = new Label(item.getBody());
    text.setFont(Font.font(null, 20));
    text.setWrapText(true);
    hbox.getChildren().add(text);

    return hbox;
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:31,代码来源:SocialMediaItemViewCell.java


注:本文中的javafx.scene.image.ImageView.setCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。