• Post Reply Bookmark Topic Watch Topic
  • New Topic

JOptionPanes with editable showInputDialogs?  RSS feed

 
luke patte
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a method to get user input by using a drop down menu, and if the item is not held in the menu then the user can type one in in the box? Such as below, only with the box editable
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");
cheers all
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out this example in the Java Tutorial:How to Use Combo Boxes
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!