aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JOptionPane - showInputDialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JOptionPane - showInputDialog" Watch "JOptionPane - showInputDialog" New topic
Author

JOptionPane - showInputDialog

c york
Greenhorn

Joined: Mar 16, 2006
Posts: 28
I am having problems with displaying the second input dialog. Can someone help me!

import javax.swing.JOptionPane;

public class GetInputFromKeyboardJOptionPane{

public static void main(String[] args) {
String name = "";

name = JOptionPane.showInputDialog("Please enter your name");
String msg = "Hello " + name + "!";
JOptionPane.showMessageDialog(null, msg);

String age = "";
int ageint = Integer.parseInt(age);

age = JOptionPane.showInputDialog("Please enter your age");
if (ageint > 100){
String msg2 = "Hello " + name + "You are old!";
JOptionPane.showMessageDialog(null, msg2);
}else{
String msg3 = "Hello " + name + "You are young!";
JOptionPane.showMessageDialog(null, msg3);
}

}
}
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Change this

to this
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JOptionPane - showInputDialog