-
ComboBox Error
Hey, I'm having problems when trying to put a combobox into my program. When ever I use the following code for a comboBox I just keep getting the same error as below when compiling, then a screen full of text in the cmd (nothing runs), Id I comment it out the program runs fine. Is this a general problem to do with my code or something else? Thanks.
Code:
String custAge[] = {"1","2","3","4"};
JComboBox combo = new JComboBox(custAge);
optionPanel.add(combo);
Error:
Note: H:\Booking.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Tool completed successfully
-
Re: ComboBox Error
Thats only a warning message, no error message! You are using Java 7 or?
-> Try to use the generic way: JComboBox<String> combo = new JComboBox<String>(custAge);
-
Re: ComboBox Error
ahhh the problem was it would compile with that warning, then you ran it but it just gave you a cmd full of text, you closed that then it ran fine :S Anyway that generic way solved it and it works fine with no warnings now, thanks!