嗨,伙计们,我遇到了这样的麻烦
在带有组合框的对话框中
public JComboBox<IngrMeasureUnit> getUnits(){
JComboBox<IngrMeasureUnit> result = new JComboBox<IngrMeasureUnit>();
for ( int i = 0; i < parent.getIngrList().imul.getSize(); i++ ) {
result.addItem(parent.getIngrList().imul.getMeasureUnit(i));
}
return result;
}
和班级
public class IngrMeasureUnit {
private int id;
private String name;
private boolean mustInt;
public IngrMeasureUnit( int id, String name, boolean mustInt ) {
this.id = id;
this.name = name;
this.mustInt = mustInt;
}
public String toSrting() {
return name;
}
无法理解这种行为,因为在其他情况下它有效。试图把@Override注解,编译器拒绝它。谢谢。