/[classpath]/classpath/gnu/java/beans/DummyAppletContext.java
ViewVC logotype

Diff of /classpath/gnu/java/beans/DummyAppletContext.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.2 by gnu_andrew, Tue Aug 2 20:12:09 2005 UTC revision 1.1.2.3 by gnu_andrew, Sun Nov 27 21:00:36 2005 UTC
# Line 63  import java.util.Iterator; Line 63  import java.util.Iterator;
63  class DummyAppletContext implements AppletContext  class DummyAppletContext implements AppletContext
64  {  {
65    private static final Enumeration EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_SET);    private static final Enumeration EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_SET);
   private static final AudioClip DUMMY_CLIP = new DummyAudioClip();  
66    
67    DummyAppletContext()    DummyAppletContext()
68    {    {
# Line 80  class DummyAppletContext implements Appl Line 79  class DummyAppletContext implements Appl
79     */     */
80    public AudioClip getAudioClip(URL url)    public AudioClip getAudioClip(URL url)
81    {    {
82      try      return Applet.newAudioClip(url);
       {  
         return (url.openConnection() != null ? DUMMY_CLIP : null);  
       }  
     catch (IOException ioe)  
       {  
         return null;  
       }  
83    }    }
84    
85    /** Loads the <code>Image</code> instance by delegating to    /** Loads the <code>Image</code> instance by delegating to
# Line 170  class DummyAppletContext implements Appl Line 162  class DummyAppletContext implements Appl
162    {    {
163      return Collections.EMPTY_SET.iterator();      return Collections.EMPTY_SET.iterator();
164    }    }
   
   /** Dummy <code>AudioClip</code> implementation that does nothing but  
    * preventing <code>NullPointerException</code>S being thrown in programs  
    * that expect a valid <code>AudioClip</code> instance to be returned by  
    * their Applet.  
    *  
    * @author Robert Schuster  
    */  
   static class DummyAudioClip implements AudioClip  
   {  
     public void play()  
     {  
     }  
   
     public void stop()  
     {  
     }  
   
     public void loop()  
     {  
     }  
   
     public String toString()  
     {  
       return "DummyAudioClip never plays anything - implement javax.sound and make us happy :)";  
     }  
   }  
165  }  }

Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26