File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JOptionPane.showInputDialog          quick question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JOptionPane.showInputDialog          quick question" Watch "JOptionPane.showInputDialog          quick question" New topic
Author

JOptionPane.showInputDialog quick question

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
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
 
subject: JOptionPane.showInputDialog quick question