java - found raw type: JComboBox -
i have simple source file guiapp1.java trying compile cmd javac. gives me warning :
c:\users\thakkar\java>javac guiapp1.java note: guiapp1.java uses unchecked or unsafe operations. note: recompile -xlint:unchecked details.
so used cmd javac -xlint guiapp1.java compile source file.
it gave me 6 warnings e.g.
guiapp1.java:48: warning: [rawtypes] found raw type: jcombobox jcombobox fruits = new jcombobox(fruitoptions); ^ missing type arguments generic class jcombobox<e> e type-variable: e extends object declared in class jcombobox
how can solve this?
starting java 7 many swing components use generics, older code produce warning raw types.
for combobox example can eliminate warning if provide type of objects holds e.g. should use jcombobox<string> fruits = new jcombobox<>(fruitoptions);
if fruitoptions
string[]
. if use other type change accordingly.
Comments
Post a Comment