当前位置: 首页>>代码示例>>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;未经允许,请勿转载。