A Program that Uses the JOptionPane Class to Get User Input : OptionPane « Swing JFC « Java
- Java
- Swing JFC
- OptionPane
A Program that Uses the JOptionPane Class to Get User Input
import javax.swing.JOptionPane;
public class MainClass {
public static void main(String[] args) {
String s;
s = JOptionPane.showInputDialog("Enter an integer:");
int x = Integer.parseInt(s);
System.out.println("You entered " + x + ".");
}
}
Related examples in the same category