Results 1 to 4 of 4
  1. #1
    doha786 is offline Member
    Join Date
    Mar 2009
    Posts
    48
    Rep Power
    0

    Question how to create more than one drop-down list in single JOptionInput Dialog ?

    hi,

    anybody can tell me please how to create more than one drop-down list or combo box in a single JOptionInput dialog ??

    suppose, my program want to ask "select any three of your Favorite animals ".. then how can i set it ??
    Java Code:
    Object[] selectionValues1 = { "Pandas", "dogs", "Cats", "Deers", "Monkeys", "Birds" };
    String initialSelection1 = "Dogs";
        
    Object[] selectionValues2= {"Pandas", "dogs", "Cats", "Deers", "Monkeys", "Birds"} ;
     String initialSelection2="Cats"; 
             
     Object selection1 = JOptionPane.showInputDialog(null, "Select any three of your favorite animals?",
            "Zoo Quiz", JOptionPane.QUESTION_MESSAGE, null, selectionValues1, initialSelection1);
    what we are thinking, it might not be true

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You'll likely need to create two JComboBoxes, place them in a JPanel and then place that JPanel into the JOptionPane's Object parameter.

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default

    And once you add the panel to the JOptionPane you may want to consider the Dialog Focus suggestion.

  4. #4
    doha786 is offline Member
    Join Date
    Mar 2009
    Posts
    48
    Rep Power
    0

    Default

    thanks a lot both of you....

    now got it..really appreciated.
    what we are thinking, it might not be true

Similar Threads

  1. Replies: 1
    Last Post: 03-14-2010, 10:03 PM
  2. Populating a drop down list from a database
    By matpj in forum New To Java
    Replies: 0
    Last Post: 01-19-2009, 12:14 PM
  3. Replies: 0
    Last Post: 07-02-2008, 07:54 PM
  4. How to create a Dialog Shell
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-02-2008, 07:52 PM
  5. JComboBox and drop-down list.....HELP!!!!!
    By Anna in forum AWT / Swing
    Replies: 1
    Last Post: 06-18-2008, 05:16 AM

Posting Permissions

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