I'm trying to check in this method if my Square, which inherits from Rectangle, was filled with an ImagePattern via the getFill () function:
public boolean HouseIsValid(House Square) {
return (Square.getFill().equals(green) || Square.getFill().equals(lightgreen));
}
Being green and lightgreen two ImagePatterns which are declared in this method in my constructor:
public void setImagePatterns() {
ImageView image = new ImageView("/Images/greenhouse.jpg");
green = new ImagePattern(image.getImage());
image = new ImageView("/Images/lightgreenhouse.jpg");
lightgreen = new ImagePattern(image.getImage());
}
There is a method in my Square class to determine the ImagePattern of it, so in a given moment of my main code, I change the ImagePattern to those above:
public void setFill(String url) {
ImageView image = new ImageView(url);
setBackground(new ImagePattern(image.getImage()));
setFill(background);
}
However, it returns false, when it should return true. I would like to know what is wrong in validating the first method. Thanks in advance.