I have an element with the ID history
type of TableView
. How can I find and access this object if I have the instance of Scene scene
?
The fx:id attribute is a unique identifier of a component, which can be used to reference the component from other parts of our FXML and even our Controller.
Each JavaFX Node has its own cartesian coordinate system. The only difference from a regular cartesian coordinate system is that the Y axis is reversed. That means, that the origo of the coordinate system is in the upper left corner of the coordinate system.
Each item in the scene graph is called a Node . Branch nodes are of type Parent , whose concrete subclasses are Group , Region , and Control , or subclasses thereof. Leaf nodes are classes such as Rectangle , Text , ImageView , MediaView , or other such leaf classes which cannot have children.
Every Scene needs exactly one Parent as the root .
Try
TableView tb = (TableView) scene.lookup("#history");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With