OK i am using eclipse and its GUI editor and i have a string like this:
public static String[] blah = {"Blah", "Blah", "Blah", "Blah"};
and a JComboBox like this:
JComboBox comboBox = new JComboBox(blah);
comboBox.setBounds(10, 56, 312, 37);
contentPane.add(comboBox);
The combobox uses the string above to get its data but when i enter in “blah” to the combobox it has this error…
Type safety: The constructor JComboBox(Object[]) belongs to the raw type JComboBox. References to generic type JComboBox<E> should be parameterized
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…
INVALID SOURCE. No Constructor Binding. --- new JComboBox(locations) is not valid source for component creation, it references not existing constructor.
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
JComboBox<E>whitch is new in jre7.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.