Пример #1
0
  @Override
  public void actionPerformed(ActionEvent event) {
    if (event.getSource() == boutonJouer) {
      String s =
          (String)
              JOptionPane.showInputDialog(
                  this,
                  "Veuillez entrer votre nom",
                  "Nouvelle partie",
                  JOptionPane.PLAIN_MESSAGE,
                  null,
                  null,
                  "Dupont");

      // If a string was returned, say so.
      if ((s != null) && (s.length() > 0)) {
        Joueur.getInstance().setUsername(s);
      } else return;

      this.setVisible(false);
      mainWindow.setVisible(true);
    } else if (event.getSource() == boutonAbout) {
      textWindow.setVisible(true);
    }
  }