showInputDialog() Example
In this example we show one way of getting information from the user from within an applet, by using JOptionPane.showInputDialog().
// showInputDialog() Example
import java.awt.*;
import javax.swing.*;
class ShowInputDialogExample extends JApplet {
String input;
@Override public void init() {
input = JOptionPane.showInputDialog("Enter something here" );
}
@Override public void paint(Graphics g) {
super.paint(g);
g.drawString("Your input is \""+input+"\"",50,150);
}
}
