title: How to mark JTable cell input as invalid?
body: <p>If I take a <code>JTable</code> and specify a column's classtype on it's model as follows:</p>
  
  <pre><code>   DefaultTableModel model = new DefaultTableModel(columnNames, 100) {
         @Override
          public Class&lt;?&gt; getColumnClass(int columnIndex) {
              return Integer.class;
          }};
  </code></pre>
  
  <p>Then whenever a user tries to enter a <code>double</code> value into the table, Swing automatically rejects the input and sets the cell's outline to red.</p>
  
  <p>I want the same effect to occur when someone enters a 'negative or 0' input to the cell.  I've got this:</p>
  
  <pre><code>    @Override
      public void setValueAt(Object val, int rowIndex, int columnIndex) {
         if (val instanceof Number &amp;&amp; ((Number) val).doubleValue() &gt; 0) {
                super.setValueAt(val, rowIndex, columnIndex);
              } 
         }
     }
  </code></pre>
  
  <p>This prevents the cell from accepting any non-positive values, but it doesn't set the color to red and leave the cell as editable.  </p>
  
  <p>I tried looking into how JTable's doing the rejection by default, but I can't seem to find it. </p>
  
  <p>How can I make it reject the non-positive input the same way it rejects the non-Integer input?</p>