我有一个来自所选表列的int变量(modID)。我想使用这个变量来搜索两列组合框(int modelID,String model),匹配组合框的modelID列并显示相应的模型值。
用于构造组合框的类。
package batteryOrdering.order;
public class ModelList {
private int modelID;
private int manufacturerID;
private String model;
public ModelList(int modelID, String model) {
this.modelID = modelID;
this.manufacturerID = manufacturerID;
this.model = model;
}
public int getModelID() {
return modelID;
}
public int getManufacturerID() {
return manufacturerID;
}
public String getModel() {
return model;
}
}
以下代码与组合框索引匹配,而不是ID列。有什么问题?
modelCombobox.getSelectionModel().select(modID);