wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 24183
    
  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
 
Similar Threads
Just Can't figure it out and it's due today
JOption Pane
Trouble with Exception Handling
monolithic form to object oriented abstraction
converting this to a prefix instead of a postfix calculator