Exemplo n.º 1
0
  public void search() {
    btnSearch.setEnabled(false);
    String keyword = "";

    keyword = txtKeyword.getText();

    if (keyword != null && !keyword.isEmpty()) {
      keyword = keyword.trim();
    }

    task = new CustomerSearchTask(keyword);
    task.addPropertyChangeListener(this);
    task.execute();
  }
Exemplo n.º 2
0
 // End of variables declaration//GEN-END:variables
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if ("progress".equals(evt.getPropertyName())) {
     int progress = (Integer) evt.getNewValue();
     progressBar.setValue(progress);
     if (progress == 100) {
       try {
         customers = task.get();
         populateTblCustomer();
       } catch (InterruptedException | ExecutionException ex) {
         System.out.println("Exception:" + ex);
       } finally {
         btnSearch.setEnabled(true);
       }
     }
   }
 }