问题
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