}//GEN-LAST:event_search_btnActionPerformed
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
// TODO add your handling code here:
// create an event source - reads from stdin
final EventSource eventSource = new EventSource();
eventSource.setUsername(this.user.getUsername());
eventSource.setPassword(this.user.getPassword());
eventSource.updateProducts(this.login_window);
// create an observer
final ProductHandler observer = new ProductHandler();
if (this.jCheckBox1.isSelected()){
// subscribe the observer to the event source
eventSource.addObserver(observer);
// starts the event thread
Thread thread = new Thread(eventSource);
thread.start();
}
else{
// unsubscribe the observer to the event source
eventSource.deleteObserver(observer);
}
}//GEN-LAST:event_jCheckBox1ActionPerformed