I am sorry if i asked the stupid question which might not apply in java fx.
I have the following fxml file
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="294.0" prefWidth="354.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Button fx:id="cancel" layoutX="199.0" layoutY="149.0" mnemonicParsing="false" text="Cancel" />
<Button id="ok" fx:id="ok" layoutX="259.0" layoutY="149.0" mnemonicParsing="false" text="OK" />
<TextField fx:id="field" layoutX="62.0" layoutY="120.0" prefHeight="26.0" prefWidth="229.0" />
</children>
</AnchorPane>
Now i want to load that file. So i am trying to do the following.
Node parent = FXMLLoader.load(getClass().getResource("../layout/dialog.fxml"));
Button ok = (Button) parent.lookup("#id");
Here actually i want to access ok button by using lookUp method. But it says that ok button is null.
Note : i don't want to do this by using controller attribute fx:controller or @FXML annotation.
Is there any way that is possible to do so?