I have a class called MapCanvas that extends Canvas from the JavaFX library. On this canvas, I'd like to create a method that allows a button to be placed on the canvas itself (instead of a pane on top), such that when I pan and zoom in on the canvas, the button keeps the coordinates that were specified when created (so it moves around when I drag the canvas).
The method would look like this:
public void addButton(Button button) {
// add the button to the canvas
}
So my question is: Is it possible to add a method like this, and if so, how?