File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JOptionPane.showInputDialog quick question

 
Peter Primrose
Ranch Hand
Posts: 755
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

is there anyway to place an input in the textfield of the JOptionPane.showInputDialog?

String amountSTR = JOptionPane.showInputDialog("Enter amount ");

and by default the amount will be 1000 (unless the user specifis something else)

thanks
peter
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look at the Javadoc? There are several variants of "showInputDialog" that take a "initialSelectionValue" parameter -- this is the initial value for the text field.
 
Peter Primrose
Ranch Hand
Posts: 755
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it,

thanks!


String amount = (String)JOptionPane.showInputDialog(
null,
"Enter amouny",
"amount",
JOptionPane.PLAIN_MESSAGE, null, null, "1000");
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic