title: Check duplicate data in jtable before proceeding
body: <p>In my current project I have a jtable with 4 columns. I don't want store duplicate data in second column, so I check each row in the jtable before I store it into to database.  </p>
  
  <p>Here's my code:</p>
  
  <pre><code>String s="";
  int row = table.getRowCount();
  for (int i=0; i&lt;row; i++) 
  {
      s = table.getValueAt(i, 1).toString().trim();
      if (name.getText().equals(s)) 
      {
        JOptionPane.showMessageDialog(null, "data alreadyexist.","message",JOptionPane.PLAIN_MESSAGE);
      break; 
      } else {
        add();
        break;
      }
  } 
  </code></pre>