JComboBox防止在eclipse中打开设计页面 [英] JComboBox Warning preventing opening the design page in eclipse
问题描述
public static String [] blah = {Blah,Blah,Blah,Blah};
和一个像这样的JComboBox:
JComboBox comboBox = new JComboBox(blah);
comboBox.setBounds(10,56,312,37);
contentPane.add(comboBox);
组合框使用上面的字符串获取其数据,但是当我输入blah到组合框它有这个错误...
类型安全性:构造函数JComboBox(Object [])属于原始类型JComboBox。引用通用类型JComboBox< E>应该参数化
它可以运行,因为它只是一个警告,但它是烦人的,因为它不要让我进入设计模式,除非我发表评论。设计模式给出了这个错误...
无效资源。没有构造函数绑定。 ---新的JComboBox(locations)对于组件创建来说是无效的,它不引用现有的构造函数。
所以我想知道是否有其他方法来克服这个问题
问题是WindowBuilder无法处理 所以如果你不需要java 7,你可以轻松地修复它,否则你必须等待Windowbuilder支持泛型版本。 OK i am using eclipse and its GUI editor and i have a string like this: and a JComboBox like this: The combobox uses the string above to get its data but when i enter in "blah" to the combobox it has this error... it works if i run it because it is only a warning but it is annoying because it wont let me enter design mode unless i make it a comment. design mode gives this error... so i would like to know if there is any other way to overcome this issue The problem seams to be that WindowBuilder can't handle the generics version of I had the same problem and fixed it by adding the jre6 under Preferences -> Java -> Installed JREs and ensuring that the project uses the execution Environment 'JavaSE-1.6' under Project -> properties -> Java Compiler. So if you don't need java 7 you can easily fix it, else you have to wait for Windowbuilder to support the generics version. 这篇关于JComboBox防止在eclipse中打开设计页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! JComboBox< E> $ c $的泛型版本我们有同样的问题,并且通过在首选项 - > Java下添加 jre6 来修复它。 - >安装的JRE ,并确保项目使用项目 - >属性 - > Java编译器下的执行环境'JavaSE-1.6'
public static String[] blah = {"Blah", "Blah", "Blah", "Blah"};
JComboBox comboBox = new JComboBox(blah);
comboBox.setBounds(10, 56, 312, 37);
contentPane.add(comboBox);
Type safety: The constructor JComboBox(Object[]) belongs to the raw type JComboBox. References to generic type JComboBox<E> should be parameterized
INVALID SOURCE. No Constructor Binding. --- new JComboBox(locations) is not valid source for component creation, it references not existing constructor.
JComboBox<E>
whitch is new in jre7.