Results 1 to 3 of 3

Thread: ComboBox Error

  1. #1
    Join Date
    Mar 2012
    Posts
    23
    Rep Power
    0

    Default 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.

    Java 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

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

    Default 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);

  3. #3
    Join Date
    Mar 2012
    Posts
    23
    Rep Power
    0

    Default 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!

Similar Threads

  1. Combobox
    By asai in forum New To Java
    Replies: 5
    Last Post: 02-21-2012, 08:11 PM
  2. combobox
    By dina in forum AWT / Swing
    Replies: 7
    Last Post: 05-11-2011, 06:31 PM
  3. combobox
    By leader in forum New To Java
    Replies: 2
    Last Post: 02-12-2011, 10:30 PM
  4. Need Help combobox
    By kwink in forum AWT / Swing
    Replies: 3
    Last Post: 03-21-2009, 11:05 AM
  5. combobox
    By chandu.v in forum New To Java
    Replies: 2
    Last Post: 07-02-2008, 09:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •