Reputation: 4096
I am trying to put a Label inside of GridPane in JavaFX.
I have following code:
@FXML
private Label nameCheck;
@FXML
private GridPane gridPane;
gridPane.add(nameCheck, 0, 0);
But, when I am trying to do so, it is giving me error saying:
The method add(Node, int, int) in the type GridPane is not applicable for the arguments (Label, int, int)
When I tried to put Text
inside of GridPane
, it happens properly. Why is it giving me problem with Label
only?
Isn't Label a Node?
Upvotes: 1
Views: 4185
Reputation: 26405
Are you sure that you are not using java.awt.Label instead of javafx.scene.control.Label ? And yes Label is Node.
Upvotes: 4