I'm new to JavaFX and still learning I have this problem and couldn't find an answer.
I have two FXML files named "one.fxml" and "two.fxml" and they have their own controller classes naming "OneController.java" and "TwoController.java"
I'm want to open a "two.fxml" with onButtonClick from "one.fxml".
The Button Code in "one.fxml" is:
<Button fx:id="clearButton" layoutX="690.0" layoutY="309.0" minHeight="18.0" mnemonicParsing="false" prefHeight="40.0" prefWidth="196.0" text="Clear" onAction="#buttonclearClick"/>
and I have this method in "OneController.java"
private void buttonclearClick(final ActionEvent event)
{
//code to be written?
}
also how do I transfer values of the certain fields from "one.fxml" to "two.fxml"
like:
if "one.fxml" also has this tag:
<Text fx:id="textLabel" fill="#001f4b" layoutX="14.0" layoutY="377.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Powered by StackOverflow">
how do I transfer this text field value(text="Powered by StackOverflow") to "two.fxml" or TwoController.java
How to achieve this?
One Controller
Two Controller
Make a function GettextVal in two controller