I'm migrating an application containing JavaFX 2 to OpenJDK11. I have an error due to disappearance of inheritance of SkinBase with StackPane. I can't use anymore methods like event methods (defined in Node), getChildren() (defined in Parent) and many others that require inheritence...
This my previous Class in Java 1.7, that I want in JDK11 :
public class WellPlateSkin<T> extends SkinBase<WellPlate, WellPlateSkin.DummyBehaviour> { public WellPlateSkin(final WellPlate control) { super(control, new DummyBehaviour(control)); ... setOnMouseDragged(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { dragging = true; onMouseDragged(mouseEvent); } }); setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { mousePressed = new Point2D(mouseEvent.getX(), mouseEvent.getY()); getChildren().add(glass); removeSelection(); rubber.setHeight(0); rubber.setWidth(0); dragging = false; } }); setOnMouseReleased(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (!dragging) { selectNode(new Point2D(mouseEvent.getX(),mouseEvent.getY())); } mousePressed = null; getChildren().remove(glass); dragging =false; } }); These methods inherit from Class Node or Parent That's worked because the signature of SkinBase was (before JavaFX8) :
public abstract class SkinBase<C extends Control, B extends BehaviorBase<C>> extends StackPane implements Skin<C> { And StackPane is a child of Pane which is a child of Region which is a child of Parent and which is a child of Node.
Now, in JDK11, the signature of SkinBase is
public abstract class SkinBase<C extends Control> implements Skin<C> { The Inheritence doesn't exist anymore and these functions are no more defined (the super() neither). What is the best way to sovle this issue ? Thank you for your answer !
onMouseDragged) you would just add them to the control directly, rather than through the skin. TheSkinBaseclass has agetChildren()method that simply returns the child-list of theControl. I'm not positive whatselectNodedoes, but I'm assuming it selects the top-most node at the given coordinates; if so, seeMouseEvent#getPickResult().