import java.io.File; import javafx.scene.image.Image; import javafx.scene.paint.Color; import javafx.scene.paint.ImagePattern; import javafx.scene.shape.Circle; public class Moon extends Circle { public Moon(double x, double y) { this.setCenterX(x); this.setCenterY(y); this.setRadius(25); this.setFill(Color.CYAN); } I asked in the English forum, they said that a duplicate of the question:
I tried to paste the following code inside:
File file = new File("moon.png"); String path = file.getAbsolutePath(); Image mn = new Image(path); this.setFill(new ImagePattern(mn)); But the problem is that with such an action I’m throwing out the window "Hot code replace failed - Scheme change not implemented", then refuses to compile, which makes further attempts to somehow use this code and, accordingly, that answer is useless for my case. I would like to know your opinion on how to deal with it. Perhaps this is due to the fact that there was a circle created through
Circle moon = new Circle(); When i have
Public class Moon extends Circle{...} I'm also not sure if the path to the picture is right, for the path to it is:
*** / eclipse-workspace / ProjectName / src / sample / moon.png