當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。