jQuery in Action, 3rd edition
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JOptionPane.showInputDialog          quick question" Watch "JOptionPane.showInputDialog          quick question" New topic

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)

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

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,


String amount = (String)JOptionPane.showInputDialog(
"Enter amouny",
JOptionPane.PLAIN_MESSAGE, null, null, "1000");
I agree. Here's the link: http://aspose.com/file-tools
subject: JOptionPane.showInputDialog quick question
It's not a secret anymore!