How is it possible to declare an object of type option in Java? I was told that the following code would convert a Vector of Strings into a Vector of Option, but new Option(String) is not a valid constructor:
private <T> Vector<Option> convertToOptions( Vector<T> convert )
{
Vector<Option> options = new Vector<Option>();
for ( T temp : convert )
options.add( new Option( temp.toString() ) );
return options;
}
It looks like you might need to create an
AttributeSetand then convert it to anOption? Something like this…Otherwise, if you’re creating a dropdown, are you using
JComboBox? If so, this has aJComboBox(Vector)constructor – might be much easier. Otherwise, what class are you using to create the dropdown?