7
javaFx의 콤보 상자에 채울 값 목록이 있습니다. 이것은이 내 combo.xmlJavaFx에서 콤보 상자에 목록 값을 채우는 방법
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="- Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2">
<children>
<ComboBox id="comboId" layoutX="210.0" layoutY="108.0" prefHeight="27.0" prefWidth="102.0" promptText="Select">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Item 1" />
<String fx:value="Item 2" />
<String fx:value="Item 3" />
</FXCollections>
</items>
</Com boBox>
</children>
</AnchorPane>
내 주요
public class JavaFXExperiment extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("combo.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
final ComboBox comboId = new ComboBox();
comboId.getItems().addAll(
"[email protected]",
"[email protected]",
"ethan.wil[email protected]",
"[email protected]",
"[email protected]");
}
public static void main(String[] args) {
launch(args);
}
}
이 내 xml 파일과 내가 combobox.anyone에 그 값을 표시 할 기본 클래스 도와주세요입니다
감사합니다,이 또한 작동합니다. – lmiguelvargasf
'@FXML 공용 ComboBox myCombobox; – saikosen