Im Versuch, einen String zu einem javafx comboBox hinzuzufügen, aber ich halte den obigen Fehler bekommen:/
javafx fxml ComboBox Fehler
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 ?
CODE
room_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>
UPDATE
Nach einer Liste mit, bekomme ich
inkompatible Typen: String kann nicht konvertiert werden # 1
wo CAP # 1 ist ein frischer Typ-Variable zu CAP: Object von der Erfassung von
CAP # 1 erstreckt?
versuchen Sie, Ihren Code in einem anderen Compiler zu kompilieren! –
Können Sie die Deklaration von 'room_id' im Controller anzeigen? –