String[] boxOptions = {"1","2","4","8","16","20","40","100","400"}; JComboBox box = new JComboBox(boxOptions);
我之前在程序中有这些确切的代码行,但没有收到此错误。我做了一些搜索,发现的结果使我有些头疼。有任何想法吗?
错误是:
JComboBox is a raw type. References to generic type JComboBox<E> should be parameterized
您可以使用:
JComboBox<String> box = new JComboBox<>(boxOptions);
发生这种情况是因为JComboBox现在是泛型类。
JComboBox