當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.setSmooth方法代碼示例

本文整理匯總了Java中javafx.scene.image.ImageView.setSmooth方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.setSmooth方法的具體用法?Java ImageView.setSmooth怎麽用?Java ImageView.setSmooth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.image.ImageView的用法示例。


在下文中一共展示了ImageView.setSmooth方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: InferenceRuleView

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
/**
 * Adds the content for showing the inference rules to the TabPane in the proof
 * @param tabPane
 *
 */
public InferenceRuleView(TabPane tabPane) {


    //load the image
    Image image = new Image("inferenceRules.png");
    ImageView iv1 = new ImageView();
    iv1.setImage(image);
    iv1.setSmooth(true);
    iv1.setPreserveRatio(true);

    //putting the image on a scrollpane
    ScrollPane sp=new ScrollPane();
    sp.getStyleClass().add("rulesView");
    tab = new ViewTab("Inference Rules",this);
    sp.setContent(iv1);
    tabPane.getTabs().add(tab);
    tab.setContent(sp);
    tabPane.getSelectionModel().select(tab);

    //used for getting screensize
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //Avoids scaling too much
    double w=primaryScreenBounds.getWidth()/2;
    iv1.setFitWidth(w);
}
 
開發者ID:nonilole,項目名稱:Conan,代碼行數:31,代碼來源:InferenceRuleView.java

示例2: createIcon

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
/**
 * Creates the left side Icon
 * @return Returns a StackPane
 */
public StackPane createIcon(){
    StackPane layout = new StackPane();
    layout.setAlignment(Pos.CENTER);

    final ImageView imageView = new ImageView(
            sample.Main.class.getResource(ICONS_PATH + content.getIconPath() + ICONS_EXT).toString() );

    imageView.setPreserveRatio(true);
    imageView.setSmooth(true);
    imageView.setFitHeight(25.0f);
    imageView.setFitWidth(25.0f);

    layout.getChildren().add(imageView);

    return layout;
}
 
開發者ID:Theldus,項目名稱:PSE,代碼行數:21,代碼來源:ItemView.java

示例3: 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

示例4: 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

示例5: 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

示例6: ImagePropertiesSample

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
public ImagePropertiesSample() {
    //we can set image properties directly during creation
    ImageView sample1 = new ImageView(new Image(url, 30, 70, false, true));

    ImageView sample2 = new ImageView(new Image(url));
    //image can be resized to preferred width
    sample2.setFitWidth(200);
    sample2.setPreserveRatio(true);
    
    ImageView sample3 = new ImageView(new Image(url));
    //image can be resized to preferred height
    sample3.setFitHeight(20);
    sample3.setPreserveRatio(true);
    
    ImageView sample4 = new ImageView(new Image(url));
    //one can resize image without preserving ratio between height and width
    sample4.setFitWidth(40);
    sample4.setFitHeight(80);
    sample4.setPreserveRatio(false);
    sample4.setSmooth(true); //the usage of the better filter

    ImageView sample5 = new ImageView(new Image(url));
    sample5.setFitHeight(60);
    sample5.setPreserveRatio(true);
    //viewport is used for displaying the part of image
    Rectangle2D rectangle2D = new Rectangle2D(50, 200, 120, 60);
    sample5.setViewport(rectangle2D);

    //add the imageviews to layout
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(sample1, sample3, sample4, sample5);

    //show the layout
    VBox vb = new VBox(10);
    vb.getChildren().addAll(hBox, sample2);
    getChildren().add(vb);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:39,代碼來源:ImagePropertiesSample.java

示例7: createIcon

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
/**
 * Creates the NodeBox icon that will be in the center of it.
 * @param pathName Path to the icon, including the filename.
 * @param dimension Icon dimensions.
 * @return Returns an ImageView with the image loaded into it.
 */
private ImageView createIcon(String pathName, Dimension dimension ){
    ImageView imageView = new ImageView( sample.Main.class.getResource(ICONS_PATH + pathName + ICONS_EXT).toString() );
    imageView.setPreserveRatio(true);
    imageView.setSmooth(true);
    imageView.setFitWidth(dimension.getWidth());
    imageView.setFitHeight(dimension.getHeight());
    return imageView;
}
 
開發者ID:Theldus,項目名稱:PSE,代碼行數:15,代碼來源:NodeBox.java

示例8: updateItem

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
@Override
protected void updateItem(Object item, boolean empty) {
	super.updateItem(item, empty);

	this.setAlignment(Pos.CENTER);

	if (item != null) {
		if (item instanceof String) {
			setText((String) item);
			setGraphic(null);
		} else if (item instanceof Image) {
			setText(null);
			ImageView imageView = new ImageView((Image) item);

			double width = ((Image) item).getWidth();
			double height = ((Image) item).getHeight();
			double x = 0;
			double y = height / 4;

			// define crop in image coordinates:
			Rectangle2D croppedPortion = new Rectangle2D(x, y, width, height / 3);

			imageView.setViewport(croppedPortion);
			imageView.setFitWidth(180);
			imageView.setFitHeight(50);
			imageView.setSmooth(true);
			setGraphic(imageView);
		} else {
			setText(null);
			setGraphic(null);
		}
	}
}
 
開發者ID:Team-Sprout,項目名稱:Clipcon-Client,代碼行數:34,代碼來源:MainScene.java

示例9: 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

示例10: ExtendedAnimatedFlowContainer

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
/**
 * Creates a container with the given animation type and duration.
 *
 * @param duration          the duration of the animation
 * @param animationProducer the {@link KeyFrame} instances that define the animation
 */
public ExtendedAnimatedFlowContainer(Duration duration, Function<AnimatedFlowContainer, List<KeyFrame>>
    animationProducer) {
    this.view = new StackPane();
    this.duration = duration;
    this.animationProducer = animationProducer;
    placeholder = new ImageView();
    placeholder.setPreserveRatio(true);
    placeholder.setSmooth(true);
}
 
開發者ID:b3log,項目名稱:JHosts,代碼行數:16,代碼來源:ExtendedAnimatedFlowContainer.java

示例11: 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.setSmooth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。