HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

"Interactive Graphics-Based Applets"
Vol. 2, Issue 11, p. 72

Download files assoicated with this article
- source code only (44 KB)

Download files assoicated with this article
- source code and HTML table of contents (86 KB)


Listing 1. 

         public class IllusionApplet extends Applet{  
             private int canvasWidth, canvasHeight;  
             private RegisterObject ro; 
             /* Shapes (models or observables) used  
              in this applet */  
             private StandardLineShape stdLine;  

             public void init(){  
             // this object helps coordinates & 
                 between shapes  
             ro = new RegisterObject 

             /* create models or observables */  
             stdLine = new  
StandardLineShape(canvasWidth, canvasHeight, ro);  

Listing 2. 

        // methods / public / IObservable implementation  
        public void addIObserver(IObserver anIObserver) {  

        public void deleteIObserver(IObserver anIObserver) {  

        public void deleteIObservers() {  

Listing 3. 

        // IObservable implementation  
        public void addIObserver(IObserver anIObserver) {  
            myObservableComponent.addIObserver & 
          (anIObserver); }  

        public void deleteIObserver(IObserver anIObserver) {  
            myObservableComponent.deleteIObserver & 
          (anIObserver); }  

        public void deleteIObservers() {  
            myObservableComponent.deleteIObservers(); }  

        // IObserver implementation  
        public void update(Object theObserved,  & 
          Object changeCode){  
           myObservableComponent.notifyIObservers & 

©Board of Trustees, University of Illinois, 1997. Information concerning  use of 
these classes and interfaces  can be obtained from the Department  of 
Psychology, University of Illinois, 603 E. Daniel, Champaign, Illinois 61801. 
Redistribution and  use, with and without modifications, are permitted for any 
purpose provided that  the source code retain the above copyright notice.  All 
publications  or advertising materials mentioning features or use of this 
software must acknowledge that it was developed by the University of Illinois at 
Urbana-Champaign and credit the contributors. THIS SOFTWARE IS PROVIDED BY THE 
EXPRESSED OR IMPLIED. In no event shall the University or the contributors be 
liable for any damages suffered by the users arising out of the  use of this 
software, even if advised of the possibility of such damage. 


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.