2017-08-16 9 views
0

私はTextFieldとmnemonicParsingがtrueのラベルを持っています。私はラベルのlabelForプロパティをTextFieldのidで設定したいと思います。 FXMLでどうすればいいですか?JavaFx:FXMLのLabelのlabelForプロパティを設定するには?

<GridPane hgap="5.0" snapToPixel="false" vgap="10.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> 
<children> 
     <Label maxWidth="-Infinity" text="_A Label" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.vgrow="NEVER" mnemonicParsing="true" /> 
     <TextField id="myTextField" GridPane.columnIndex="1" GridPane.hgrow="NEVER" /> 
</children> 
</GridPane> 

おかげ

答えて

0

解決策を見つけた場合は...

<GridPane hgap="5.0" snapToPixel="false" vgap="10.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> 
<children> 
     <Label maxWidth="-Infinity" text="_A Label" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.vgrow="NEVER" mnemonicParsing="true"> 
      <labelFor> 
       <TextField id="myTextField" GridPane.columnIndex="1" GridPane.hgrow="NEVER" /> 
      </labelFor> 
     </Label> 
     <fx:reference source="myTextField" /> 
</children> 
</GridPane> 
0

あなたはドルの表記を使用することができます。

<GridPane hgap="5.0" snapToPixel="false" vgap="10.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> 
    <children> 
      <Label labelFor="$myTextField" maxWidth="-Infinity" text="_A Label" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.vgrow="NEVER" mnemonicParsing="true" /> 
      <TextField id="myTextField" GridPane.columnIndex="1" GridPane.hgrow="NEVER" /> 
    </children> 
</GridPane> 
関連する問題