no puede implementar actionPerformed (ActionEvent) en ActionListener

Estoy haciendo un programa de cifrado de perfil con 2 cifras. Quiero tener una GUI con botones para cifrar, descifrar y salir.

Mi problema es con el método actionPerformed. Necesita lanzar la excepción que el outputStream lanza. Este es el error que recibo cuando trato de cumplirlo:

:53: error: actionPerformed(ActionEvent) in ProfileEncryption_2 cannot implement actionPerformed(ActionEvent) in ActionListener
public void actionPerformed (ActionEvent e) throws FileNotFoundException//When a button is clicked

Tengo varias soluciones, pero no estoy seguro de cómo implementarlas correctamente. Podría detectar la excepción y hacer algo con ella, pero no estoy seguro de cómo y qué. También podría verificar si el archivo existe, y si es así, luego salir, pero lo que intenté para eso tampoco funcionó.

   public void actionPerformed (ActionEvent e) throws Exception //When a button is clicked
   {
      if (e.getSource() == encrBtn)
      {
            menu.setVisible(false);
         createProfile();
         menu.setVisible(true);
      }
      else
      {
         if (e.getSource() == decrBtn)
         {
            menu.setVisible(false);
            viewProfile();
            menu.setVisible(true);
         }
         else
         {
            if (e.getSource() == exitBtn)
            {
               JOptionPane.showMessageDialog(null, "Goodbye!");
                    System.exit(0);
            }
         }
      }
   }

    //End of menu
    //Start of create/view section

   public static void createProfile() throws Exception //Create profile
   {
      String username = JOptionPane.showInputDialog("Enter your username.");
      String password, confirmPass, strEncrType;
      int intEncrType = 0, unlock = 0;
      do
      {
         password = JOptionPane.showInputDialog("Enter your password.\nIt must be more than 7 characters long.");
         confirmPass = JOptionPane.showInputDialog("Confirm password");
         if (password.equals(confirmPass) && (password.length() >= 7)) 
         {
            JOptionPane.showMessageDialog(null, "Passwords match!");
            unlock = 1;
         }
         else
         {
            if (!password.equals(confirmPass))
               JOptionPane.showMessageDialog(null, "Passwords do not match!");
            if (password.length() < 7)
               JOptionPane.showMessageDialog(null, "Password is not long enough!");
         }
      }
      while (unlock==0);
      do
      {
         strEncrType = JOptionPane.showInputDialog("Choose which encryption type you would prefer:\n1. Vigenère\n2. Erénegiv mod 4");
         if(!strEncrType.equals("1")&&!strEncrType.equals("2"))
            JOptionPane.showMessageDialog(null, "Invalid response, try again.");
      }
      while (!strEncrType.equals("1")&&!strEncrType.equals("2"));
      intEncrType = Integer.parseInt(strEncrType);
      String name = JOptionPane.showInputDialog("Enter your real name.");
      String phone = JOptionPane.showInputDialog("Enter your phone number.");
      String email = JOptionPane.showInputDialog("Enter your email.");
      String other = JOptionPane.showInputDialog("Enter notes/extra data you want stored.");
      String data = password + "-" + username + "-tester-" + name + "-" + phone + "-" + email + "-" + other + "-" + strEncrType;
      if (intEncrType ==1)
         data = encrypt1(data);
      else
         data = encrypt2(data);
      data = data + strEncrType;

        OutputStream output = new FileOutputStream(username + ".txt");
      byte buffer[] = data.getBytes();
      output.write(buffer);
      output.close();
   }

Respuestas a la pregunta(0)

Su respuesta a la pregunta