JOptionPane

OptionPane可以实现
下面是个applet的例子
import   javax.swing.*;
import   java.awt.*;
public   class   OptionPane1   extends   JApplet
{
public   void   init()
{
JOptionPane.showMessageDialog(null, "It 's   a   information   MessageDialog! ",
          "Information   Message ",JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null,new   JButton( "It 's   a   error   MessageDialog! "),
          "Error   Message. ",JOptionPane.ERROR_MESSAGE);
JOptionPane.showConfirmDialog(null, "It 's   a   confirmDialog ", "ConfirmDialog ",JOptionPane.YES_NO_OPTION);
JOptionPane.showOptionDialog(null, "It 's   a   OptionDialog. ", "OptionDialog ",JOptionPane.YES_NO_CANCEL_OPTION,
          JOptionPane.WARNING_MESSAGE,null,null,null);
Object   []options={ "OK ", "CANCEL ", "I   don 't   know. "};
JOptionPane.showOptionDialog(null,
          "it 's   a   OptionDialog   with   user-defined   options ", "OptionDialog ",
          JOptionPane.DEFAULT_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
String   inputValue=JOptionPane.showInputDialog( "It 's   a   InputDialog,please   input   a   value ");
Object   []possibleValue={ "first ", "second ", "third "};
Object   selectedValue=JOptionPane.showInputDialog(null,
            "It 's   a   inputdialog.please   choose   one ", "InputDialog ",
            JOptionPane.INFORMATION_MESSAGE,
            null,possibleValue,possibleValue[0]);
}
}             

你可能感兴趣的:(JOptionPane)