JOptionPane_私有内部类

来源:互联网 发布:阿里云服务器 php环境 编辑:程序博客网 时间:2024/06/14 08:07
private class ShowAction implements ActionListener {
  @Override
  public void actionPerformed(ActionEvent event) {
   if(typePanel.getSelection().equals("Confirm")) {
    //Confirm: 要显示的信息, 标题, 显示操作的类型, 显示的信息的类型
    JOptionPane.showConfirmDialog(OptionDialogFrame.this, getMessage(), "Title",
      getType(optionTypePanel), getType(messageTypePanel));
   } else if(typePanel.getSelection().equals("Input")) {
    if(inputPanel.getSelection().equals("Text field")) {
     JOptionPane.showInputDialog(OptionDialogFrame.this, getMessage(), "Title", getType(messageTypePanel));
    } else {
     JOptionPane.showInputDialog(OptionDialogFrame.this, getMessage(), "Title", getType(messageTypePanel),
       null, new String[] {"Yellow", "Blue", "Red"}, "Blue");
    }
   } else if(typePanel.getSelection().equals("Message")) {
    JOptionPane.showMessageDialog(OptionDialogFrame.this, getMessage(), "Title", getType(messageTypePanel));
   } else if(typePanel.getSelection().equals("Option")) {
    JOptionPane.showOptionDialog(OptionDialogFrame.this, getMessage(), "Title", getType(optionTypePanel),
      getType(messageTypePanel), null, getOptions(), getOptions()[0]);
   }
  }
 }
原创粉丝点击