javaFX FXML下拉框写法

时间:2022-05-21 17:04:48
<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>