JavaFx Image fit to Pane bad Quality

冷暖自知 提交于 2019-12-12 23:16:48

问题


I'm trying to create a GridPane containing images of equal height and width. I've put each ImageView into a Pane because without the Pane the ImageView elements don't seem to scale correctly. It kinda works with the Pane, but the quality of the ImageView gets degraded.

public class Cell extends Pane{

public Cell(FieldCell field){
    this.field = field;

    image = new ImageView(new Image("path"));

    image.fitHeightProperty().bind(this.heightProperty());
    image.fitWidthProperty().bind(this.widthProperty());

    this.getChildren().add(image);
}

That's the Code.

Original Picture:

When inserted into a Pane:

I've also used other Pictures.

Maybe it doesn't look that bad in your opinion but if I use ImageView only and set the Width (not fitWidth) it looks much better.

来源:https://stackoverflow.com/questions/42960992/javafx-image-fit-to-pane-bad-quality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!