Results 1 to 5 of 5
  1. #1
    cowboy is offline Member
    Join Date
    Oct 2009
    Posts
    48
    Rep Power
    0

    Default Input box with combobox within

    How i can create an Inputbox with combobox in it? In java Tutorial i 've finded this sample
    PHP Code:
    Object[] possibilities = {"ham", "spam", "yam"}; 
    String s = (String)JOptionPane.showInputDialog( 
    frame, 
    "Complete the sentence:\n" 
    + "\"Green eggs and...\"", 
    "Customized Dialog", 
    JOptionPane.PLAIN_MESSAGE, 
    icon, 
    possibilities, 
    
    "ham");
    But how i can identify the ICOn ? Can i use a string array instead object []?

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

    Default

    But how i can identify the ICOn ?
    You can use your own ImageIcon or null there in the icon position I believe.

    Can i use a string array instead object []?
    Have you tried it? What happened?

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    What? Your questions are disjointed and so is your code.

    Why do you need to have a combobox inside an "inputbox" in the first place? Just use the Combobox displaying on a panel inside a JFrame.

  4. #4
    cowboy is offline Member
    Join Date
    Oct 2009
    Posts
    48
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    You can use your own ImageIcon or null there in the icon position I believe.


    Have you tried it? What happened?
    Thanks a lot!It is so simple!

  5. #5
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    Quote Originally Posted by Fubarable View Post
    You can use your own ImageIcon or null there in the icon position I believe.


    Have you tried it? What happened?
    Yes, they can use null for both the Icon and the frame part.

Similar Threads

  1. ComboBox with CheckBoxes
    By heba.farouk in forum AWT / Swing
    Replies: 14
    Last Post: 06-09-2010, 11:03 AM
  2. Input technique for unknown lines of input
    By ducreative in forum New To Java
    Replies: 16
    Last Post: 09-23-2009, 09:26 AM
  3. Need Help combobox
    By kwink in forum AWT / Swing
    Replies: 3
    Last Post: 03-21-2009, 11:05 AM
  4. combobox
    By chandu.v in forum New To Java
    Replies: 2
    Last Post: 07-02-2008, 08:36 PM
  5. how to take input and verify input in Java programs
    By bilal_ali_java in forum Advanced Java
    Replies: 0
    Last Post: 07-21-2007, 08:46 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
  •