1
I’m trying to check in this method if my Square, which inherits from Rectangle, was filled with an Imagepattern through 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 in the class of my Square a method to determine his Imagepattern, here is that at some point 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 the validation of the first method. Thanks in advance.