Results 1 to 3 of 3
  1. #1
    NickkicN is offline Member
    Join Date
    Aug 2008
    Rep Power

    Smile Syntax for choice box(combo box)

    How do u declare and initialize choice boxes??

    Is it like

    String[] TypeItems = {"Regular", "Diet"};

    Choice cboType = new Choice(TypeItems);


    String[] TypeItems = {"Regular", "Diet"};

    cboType = new Choice(TypeItems);

    the latter gave a compiler error saying that <identifier> is expected

    Thank You in advance

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    Use a Search to find code samples.
    If you get errors, copy and paste the full text of the message, don't edit it.

  3. #3
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    Java Code:
    String[] TypeItems = {"Regular", "Diet"};
    Choice cboType = new Choice(TypeItems);
    This would work for okay a JComboBox. Choice is an AWT component. According to its api it has a single, no–argument constructor and an add(String item) method.

Similar Threads

  1. [SOLVED] Looking for web.xml syntax doc
    By Norm in forum Java Servlet
    Replies: 2
    Last Post: 08-21-2008, 07:59 PM
  2. Need help with T/F and Multiple Choice
    By sayso36 in forum Advanced Java
    Replies: 0
    Last Post: 03-12-2008, 05:39 PM
  3. Using java.awt.Choice
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-02-2008, 07:33 PM
  4. syntax error
    By gabriel in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 03:26 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