title: Trying to implement MVC pattern in Java but no JFrame is shown even though my application is "running"
body: <p>I'm trying to implement my first MVC app which allows to push a button and increment a label on it.</p>
  
  <p>This is the view:</p>
  
  <pre><code>public class View extends javax.swing.JFrame {
  
  /**
   * Creates new form View
   */
  public View() {
      initComponents();
      buttonAzzera.setEnabled(false);
  }
  
  /**
   * This method is called from within the constructor to initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is always
   * regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;                          
  private void initComponents() {
  
      labelNumber = new javax.swing.JLabel();
      buttonAzzera = new javax.swing.JButton();
      buttonIncrementa = new javax.swing.JButton();
  
      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
      getContentPane().setLayout(new java.awt.GridLayout(1, 0));
  
      labelNumber.setText("              0");
      getContentPane().add(labelNumber);
  
      buttonAzzera.setText("Azzera");
      getContentPane().add(buttonAzzera);
  
      buttonIncrementa.setText("Incrementa");
      getContentPane().add(buttonIncrementa);
  
      pack();
  }// &lt;/editor-fold&gt;                        
  
  // Variables declaration - do not modify                     
  private javax.swing.JButton buttonAzzera;
  private javax.swing.JButton buttonIncrementa;
  private javax.swing.JLabel labelNumber;
  // End of variables declaration                   
  
  public JButton getButtonIncrementa() {
      return buttonIncrementa;
  }
  
  public JButton getButtonAzzera() {
      return buttonAzzera;
  }
  
  public void setLabelNumber(String valore) {
      labelNumber.setText(valore);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and this is the simple Model:</p>
  
  <pre><code>public class Model {
  
      private int number;
      private boolean azzerabile;
  
      public Model() {
          number = 0;
          azzerabile = false;
      }
  
      //&lt;editor-fold defaultstate="collapsed" desc="Getters and Setters"&gt;
      public int getNumber() {
          return number;
      }
  
      public void setNumber(int number) {
          this.number = number;
      }
  
      public boolean isAzzerabile() {
          return azzerabile;
      }
  
      public void setAzzerabile(boolean azzerabile) {
          this.azzerabile = azzerabile;
      }
  //&lt;/editor-fold&gt;
  
      public void incrementa() {
          number++;
          if (number == 5) {
              azzerabile = true;
          }
      }
  
      public void azzera() {
          number = 0;
          azzerabile = false;
      }
  
  }
  </code></pre>
  
  <p>Now, Model and View are interconnected thanks to the Controller:</p>
  
  <pre><code>public class Controller {
  
  private View view;
  private Model model;
  
  
  public Controller(View view, Model model) {
      this.view = view;
      this.model = model;
  }
  
  
  public void assegnaGestori() {
      ActionListener gestoreIncremento;
      ActionListener gestoreAzzeramento;
  
      gestoreIncremento = new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
              model.incrementa();
              view.setLabelNumber(Integer.toString(model.getNumber()));
              // System.out.println("Ciao");
              if (model.isAzzerabile()) {
                  view.getButtonAzzera().setEnabled(true);
              }
          }
      };
  
      view.getButtonIncrementa().addActionListener(gestoreIncremento);
  
      gestoreAzzeramento = new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
              model.azzera();
              view.setLabelNumber("0");
              view.getButtonAzzera().setEnabled(false);
          }
      };
  
      view.getButtonAzzera().addActionListener(gestoreAzzeramento);
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And I use a Main class to run the app:</p>
  
  <pre><code>public class Main {
  
  public static void main(String args[]) {
      SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
             Model model = new Model();
             View view = new View();
             Controller controller = new Controller(view, model);
             controller.assegnaGestori();
          }
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Unfortunately, when I click run no JFrame is shown, as this image shows:</p>
  
  <p><a href="https://i.stack.imgur.com/afbsE.png" rel="nofollow noreferrer">no jframe shown</a></p>
  
  <ul>
  <li>Where's the mistake?</li>
  </ul>