title: Why this propertyChange() method can't handle this event?
body: <p>I am pretty new in <strong>Swing</strong> development and I have the following problem using a class that implements the <strong>PropertyChangeListener</strong> interface.</p>
  
  <p>So I have the following <strong>GUI</strong> class (I am posting only the interesting section of this class):</p>
  
  <pre><code>public class GUI extends SingleFrameApplication implements PropertyChangeListener {
  
  private MainFrame mainFrame = null;
  private static LoginFrame loginFrame;
  
      @Override
  protected void startup() {
      boolean offLine = false;
              showLoginFrame();
  
      mainFrame = new MainFrame(settings, tasksSettings, logAppender);
  
      if (OSUtils.isUbuntuPrecisePangolin() || OSUtils.isFedoraBeefyMiracle() || OSUtils.isFedoraSphericalCow()) {
          File mountPointFolder = new File(System.getenv("HOME") + "/connect_drives");
          if (!mountPointFolder.exists())
              mountPointFolder.mkdir();
  
          mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
          mainFrame.addWindowListener(new WindowAdapter() {
              @Override
              public void windowClosing(WindowEvent e) {
                  if (mainFrame.getState() == JFrame.ICONIFIED)
                      tryToExit();
                  else
                      mainFrame.setState(JFrame.ICONIFIED);
              }
          });
      }
  }
  
  private void showLoginFrame() {
      loginFrame = new LoginFrame();
      loginFrame.setVisible(true);
      loginFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
      // Notify every change to every bound property for that object:
      loginFrame.addPropertyChangeListener(this); 
  
  }
  
  @Override
  protected void shutdown() {
      System.out.println("Entered into GUI ---&gt; shutdown()");
      logger.debug("Termino l'applicazione.");
      ulogger.info(Constants.APP_TITLE + "|Arresto "+ Constants.APP_TITLE);
      // FileUtils.saveGeneralLogFile(logAppender.getLogInFile());
      logAppender.saveGeneralLogFile();
      EventBusService.unsubscribe(this);
      if (mainFrame != null)
          mainFrame.setVisible(false);
  
  }
  public static void main(String[] args) {
  
      launch(GUI.class, args);
  }
  
  @Override
  public void propertyChange(PropertyChangeEvent arg0) {
      System.out.println("GUI SingleFrameApplication ---&gt; propertyChange(): " + arg0.getPropertyName());
  
      if (arg0.getPropertyName().equals("buttonLogOffClicked")) {
          //System.out.println("GUI SingleFrameApplication ---&gt; richiamo exit");
          //exit();
  
          mainFrame.OnWindowClose();
          mainFrame.dispose();
          mainFrame = null;
  
          showLoginFrame();
      }
  
      if (arg0.getPropertyName().equals("loginResult")) {
          System.out.println("GUI SingleFrameApplication ---&gt; richiamo MainFrame");
          //loginFrame.setVisible(false);
          loginFrame.dispose();
          loginFrame = null;
  
          showMainFrame();
      }
  
  }
  
  private void showMainFrame() {
  
      mainFrame = new MainFrame(settings, tasksSettings, logAppender);
      // I add a PropertyChangeListener to the created MainFrame object:
      mainFrame.addPropertyChangeListener(this);
      mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
      WindowListener exitListener = new WindowAdapter() {
  
          @Override
          public void windowClosing(WindowEvent e) {
              System.out.println("GUI SingleFrameApplication --&gt; windowClosing");
              shutdown();
              // mainFrame.setVisible(false);
              /*int confirm = JOptionPane.showOptionDialog(frame,
              "Are You Sure to Close this Application?",
              "Exit Confirmation", JOptionPane.YES_NO_OPTION,
              JOptionPane.QUESTION_MESSAGE, null, null, null);
              if (confirm == JOptionPane.YES_OPTION) {
              System.exit(1);
              }*/
          }
      };
  
      mainFrame.addWindowListener(exitListener);
      mainFrame.setVisible(true);
  }
  </code></pre>
  
  <p>Then I have the <strong>MainFram</strong> class that extends a <strong>JFrame</strong> in which there is a <strong>JButton</strong> to perform the log out operation, something like this:</p>
  
  <pre><code>public class MainFrame extends JFrame {
      private final Action actionLogOut = new AbstractAction() {
          {
              putValue(Action.NAME, _("log-out"));
          }
  
          @Override
          public void actionPerformed(ActionEvent e) {
              System.out.println("logOutButton clicked !!!, firePropertyChange() will start");
              // System.exit(0);
              firePropertyChange("buttonLogOffClicked", false, true);
          }
      };
  
      public MainFrame(Settings settings, TasksSettings tasksSettings, LogAppender logAppender) {
          super();
      ......................
      ......................
      ......................
      header.add(new JButton(actionLogOut));
      ......................
      ......................
      ......................
      }
  }
  </code></pre>
  
  <p>So when my <strong>JButton</strong> is clicked it is performed this method:</p>
  
  <pre><code>private final Action actionLogOut = new AbstractAction() {
      {
          putValue(Action.NAME, _("log-out"));
      }
  
      @Override
      public void actionPerformed(ActionEvent e) {
          System.out.println("logOutButton clicked !!!, firePropertyChange() will start");
          // System.exit(0);
          firePropertyChange("buttonLogOffClicked", false, true);
      }
  };
  </code></pre>
  
  <p>infact when I click on the button, in the console, appear to me the output:</p>
  
  <p><strong>"logOutButton clicked !!!, firePropertyChange() will start"</strong></p>
  
  <p>and then I execute the <strong>firePropertyChange()</strong> method and I would expect that this event was handle by this method of <strong>GUI</strong> class:</p>
  
  <pre><code>@Override
  public void propertyChange(PropertyChangeEvent arg0) {
      System.out.println("GUI SingleFrameApplication ---&gt; propertyChange(): " + arg0.getPropertyName());
  
      if (arg0.getPropertyName().equals("buttonLogOffClicked")) {
          //System.out.println("GUI SingleFrameApplication ---&gt; richiamo exit");
          //exit();
  
          mainFrame.OnWindowClose();
          mainFrame.dispose();
          mainFrame = null;
  
          showLoginFrame();
      }
  
      if (arg0.getPropertyName().equals("loginResult")) {
          System.out.println("GUI SingleFrameApplication ---&gt; richiamo MainFrame");
          //loginFrame.setVisible(false);
          loginFrame.dispose();
          loginFrame = null;
  
          showMainFrame();
      }
  
  }
  </code></pre>
  
  <p>But don't work and seems not enter in the <strong>firePropertyChange()</strong> method?</p>
  
  <p>Why? What am I missing?</p>
  
  <p>Tnx</p>
  
  <p>Andrea</p>