Package design_patterns.observer

Examples of design_patterns.observer.EventSource


    }//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
View Full Code Here

TOP

Related Classes of design_patterns.observer.EventSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.