Error de JavaBox fxml ComboBox
Estoy tratando de agregar una cadena a un comboBox javafx pero sigo recibiendo el error anterior: /
no suitable method found for add(String)
method Collection.add(CAP#1) is not applicable
(argument mismatch; String cannot be converted to CAP#1)
method List.add(CAP#1) is not applicable
(argument mismatch; String cannot be converted to CAP#1)
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
CÓDIGOroom_id.getItems().add("Hello");
FXML<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.AutoMaven.ui.controller.ComboTestController">
<children>
<ComboBox fx:id="room_id" layoutX="170.0" layoutY="185.0" prefHeight="31.0" prefWidth="260.0" />
</children>
</AnchorPane>
ACTUALIZARDespués de usar una lista, obtengo
tipos incompatibles: la cadena no se puede convertir a CAP # 1
donde CAP # 1 es una nueva variable de tipo:
CAP # 1 extiende el objeto desde la captura de?
ObservableList<String> list=FXCollections.observableArrayList("1","2","3","4");
room_id.setItems(list);