0
我正在製作這個javaFX應用程序,但是在給定時刻我想從場景中的某個方法獲取文本,如何將該值傳遞給我的文本框在FXML文件中?如何將值傳遞給fxml場景
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.72" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.crapgames.calourosimulator.views.pcna.intro.Introduction">
<children>
<ImageView fx:id="imgClick" fitHeight="600.0" fitWidth="800.0" onMouseClicked="#nextScene" pickOnBounds="true">
<image>
<Image url="@../../assets/pnca-monitor-text.png" />
</image>
</ImageView>
<Text fx:id="text1" fill="#f5eded" layoutX="8.0" layoutY="452.0" strokeType="OUTSIDE" strokeWidth="0.0" text="where i want my string variable" wrappingWidth="787.0">
<font>
<Font name="Comic Sans MS" size="25.0" />
</font></Text>
</children>
</AnchorPane>