本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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;
}