title: Java create listener on DefaultTableModel
body: <p>I'm building a Java Swing application with Java. I have my <code>JPanel</code> that have a <code>JTable</code> with a custom <code>TableModel</code>. Now I want to know if it is possible to register an envet then if in table model I start this event, the <code>JPanel</code> intercept this event and execute a method.</p>
  
  <p>This is my <code>TableModel</code>:</p>
  
  <pre><code>public class MyTableModelScontriniArticoli extends defaultTableModel {
  
      private static final String[] columnNames = {"Cod.Prod.", "Descrizione", 
              "Qta", "Prezzo cad.", "% Sconto", "Prezzo Tot"};
  
      public HashMap&lt;String, ArticoliScontrini&gt; mappaArticoli = 
              new HashMap&lt;String, ArticoliScontrini&gt;();
  
      private static NumberFormat decimalFormatter2 = new DecimalFormat("#,##0.00");
  
      private Integer numeroPz = 0;
  
      public Boolean gestisciTagliaColore;
  
      public MyTableModelScontriniArticoli() {
  
      }
  
      public MyTableModelScontriniArticoli(boolean gestisciTagliaColore) {
          super(columnNames, 1);    // 10 righe iniziali (vuote)
          mappaArticoli = new HashMap&lt;String, ArticoliScontrini&gt;();
          this.gestisciTagliaColore = gestisciTagliaColore;
      }
  
      public MyTableModelScontriniArticoli(String[] columnnames2, int i) {
          super(columnnames2, 1);    // 10 righe iniziali (vuote)
      }
  
      public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
          super.setValueAt(aValue, rowIndex, columnIndex);
          if (columnIndex == 2) {
              //TO DO METHOD 2
              //LAUNCH EVENT
          } else if (columnIndex == 3) {
              //TO DO METHOD 3
              //LAUNCH EVENT
          } else if (columnIndex == 4) {
              //TO DO METHOD 4
              //LAUNCH EVENT
          } else if (columnIndex == 6) {
              //TO DO METHOD 6
              //LAUNCH EVENT
          }
      }
  
  }
  </code></pre>
  
  <p>My <code>tableModel</code> extends <code>DefaultTableModel</code>. Now I override <code>setValueAt</code> method and I want that after execute a condition I can run an event and the <code>JPanel</code> that contains my <code>TableModel</code> can intercept it and execute some method.</p>