2

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 !

6
  • Thank you for your answer. The only thing I found on internet is that : wiki.openjdk.java.net/display/OpenJFX/UI+Controls+Architecture (Change #1: Inheritance hierarchy) The error I have is that the methode is not defined, and that seems logical. So I had to use JavaFX2.x with my Java 1.7 (post updated, sorry). I don't know how to explain better my problem, just my program worked fine before migration and due to the disappearance of inheritance of SkinBase with StackPane, some methods is unaccessible now and I don't know what is the best thing to solve it. Commented Sep 25, 2019 at 7:08
  • no offense meant, but your description doesn't make sense (as @fabian already noted, though not so blunt <g>) You either provide a code - that's our common language - example of what you mean or your question will be closed (most probably) Commented Sep 25, 2019 at 9:50
  • Ok thank for that, I tried to be more precise, I hope it can help you Commented Sep 25, 2019 at 10:35
  • hmm .. quite a change of signature (as of fx 8, before it wasn't available or internal, can't remember which probably is why your wording sounded like nonsense, sry, padding back :) - so what you have to do is to compare the evolution of some concrete core skin over versions and do the same in your custom skin. You knew this might happen, using hidden api which might change without much notice :) Commented Sep 25, 2019 at 10:45
  • To add event handlers (e.g. onMouseDragged) you would just add them to the control directly, rather than through the skin. The SkinBase class has a getChildren() method that simply returns the child-list of the Control. I'm not positive what selectNode does, but I'm assuming it selects the top-most node at the given coordinates; if so, see MouseEvent#getPickResult(). Commented Sep 25, 2019 at 12:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.