javaFX FXML下拉框写法

时间:2021-12-06 14:29:28
<ComboBox layoutX="148.0" layoutY="468.0" prefWidth="150.0" promptText="" >
   <items>
     <FXCollections fx:factory ="observableArrayList">
       <String fx:value ="选择1"/>
       <String fx:value ="选择2"/>
       <String fx:value ="选择3"/>
       <String fx:value ="选择4"/>
   </FXCollections>
   </items>
   <value>
   <String fx:value ="选择1"/>
   </value>

</ComboBox>