private void jBPesquisarActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jBPesquisarActionPerformed // TODO add your handling code here: String text = jTFPesquisar.getText(); if (text.length() == 0) { sorter.setRowFilter(null); } else { try { sorter.setRowFilter(RowFilter.regexFilter(text)); } catch (PatternSyntaxException pse) { JOptionPane.showMessageDialog(null, "Bad regex pattern"); } catch (RuntimeException ex2) { JOptionPane.showMessageDialog(null, "Erro: " + ex2.getMessage()); } } } // GEN-LAST:event_jBPesquisarActionPerformed
private void jBPesquisarKeyTyped( java.awt.event.KeyEvent evt) { // GEN-FIRST:event_jBPesquisarKeyTyped if (evt.getKeyChar() == KeyEvent.VK_ENTER) { if (evt.getSource() == jBPesquisar) { String text = jTFPesquisar.getText(); if (text.length() == 0) { sorter.setRowFilter(null); } else { try { sorter.setRowFilter(RowFilter.regexFilter(text)); } catch (PatternSyntaxException pse) { JOptionPane.showMessageDialog(this, "Erro na pesquisa"); } catch (RuntimeException ex2) { JOptionPane.showMessageDialog(null, "Erro: " + ex2.getMessage()); } } } } } // GEN-LAST:event_jBPesquisarKeyTyped