【发布时间】:2016-01-02 03:53:07
【问题描述】:
我在volstextfield 中有以下项目列表,然后我将其传递给createGUI。我想创建一个名称为vol1HH1,vol1HH2 的JTextFields 列表。我收到一个错误Incompatible types: JTextField cannot be converted to volstextfield,有人可以帮忙吗?
public enum volstextfield {
vol1HH1, vol1HH2
}
public void createGUI() {
for (volstextfield direction : EnumSet.allOf(volstextfield.class)) {
System.out.println(direction);
direction = new JTextField(5); //i get an error here incompatible types: JTextField cannot be converted to volstextfield
}
}
【问题讨论】:
标签: java for-loop jtextfield