Beispiel #1
0
  private void PlayGameActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_PlayGameActionPerformed
    // TODO add your handling code here:
    for (int i = 0; i < 5; i++) {
      k = JOptionPane.showInputDialog(null, "Do you want to start a new game? \n 1. Yes \n 2. No");
      if (k.equals("2") || k.equals("no") || k.equals("No")) {
        this.dispose();
        MainMenu menu = new MainMenu();
        menu.setVisible(true);
        i = 5;
      } else if (k.equals("1") || k.equals("yes") || k.equals("Yes")) {
        dispose();
        SwimmingGa game = new SwimmingGa();
        game.setVisible(true);
        i = 5;
      } else {
        JOptionPane.showMessageDialog(null, "Please enter correct value");

        InputStream sound;
        try {
          sound = new FileInputStream(new File("menu.wav"));
          AudioStream audio = new AudioStream(sound);
          AudioPlayer.player.start(audio);
        } catch (IOException f) {
          System.out.println(f);
        }
      } // GEN-LAST:event_PlayGameActionPerformed
    }
  }
Beispiel #2
0
 public static void main(String[] args) {
   frame.setName(NAME);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // действие при нажатии на крестик
   frame.setLayout(new BorderLayout());
   frame.add(mainMenu, BorderLayout.AFTER_LAST_LINE);
   mainMenu.setVisible(true);
   frame.pack();
   frame.setResizable(false); // нерастяжимый
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
Beispiel #3
0
  private void homeBtnActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_homeBtnActionPerformed
    // TODO add your handling code here:
    dispose();
    MainMenu menu = new MainMenu();
    menu.setVisible(true);

    InputStream sound;
    try {
      sound = new FileInputStream(new File("menu.wav"));
      AudioStream audio = new AudioStream(sound);
      AudioPlayer.player.start(audio);
    } catch (IOException f) {
      System.out.println(f);
    }
  } // GEN-LAST:event_homeBtnActionPerformed
Beispiel #4
0
 private void regBttnActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_regBttnActionPerformed
   String user = userField.getText();
   char[] pass = pwdField.getPassword();
   String email = emailField.getText();
   String firstName = fnField.getText();
   String lastName = lnField.getText();
   try {
     User user1 = new User(user, email, pass, firstName, lastName);
     Operations.putUser(client, "usermaps", email, user1);
   } catch (ExecutionException | InterruptedException ex) {
     Logger.getLogger(RegisterForm.class.getName()).log(Level.SEVERE, null, ex);
   }
   JOptionPane.showMessageDialog(rootPane, "Login feito com sucesso!");
   this.dispose();
   MainMenu mainMenu = new MainMenu();
   mainMenu.setVisible(true);
 } // GEN-LAST:event_regBttnActionPerformed