title: Problem in closing audio clip
body: <p>i use netbeans and i have this code thru which i play an audio clip</p>
  
  <p>now, i want that when the user presses next button on the JFrame. the frame disposes another opens and the clip stops.</p>
  
  <p>here is my code:</p>
  
  <p>this goes in the mose released event of the button:</p>
  
  <pre><code>Reg1 ro = new Reg1();
  ro.setVisible(true);
  clip.close();
  this.dispose();
  </code></pre>
  
  <p>this goes in main:</p>
  
  <pre><code>java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  Welcome1 insta = new Welcome1();
                  insta.setVisible(true);
                          KeyListener s;
  
          try {
              AudioInputStream audio = AudioSystem.getAudioInputStream(new File("x.wav"));
              Clip clip = AudioSystem.getClip();
              clip.open(audio);
              clip.start();
          }
  
          catch(UnsupportedAudioFileException uae) {
              System.out.println(uae);
          }
          catch(IOException ioe) {
              System.out.println(ioe);
          }
          catch(LineUnavailableException lua) {
              System.out.println(lua);
          }
  
              }
          });
  </code></pre>
  
  <p>it shows an error in the line clip.close();</p>
  
  <p>What shoud I do to remove the error?
  Please explain your answer as I am a newbie.</p>
  
  <p><strong>The error is:</strong></p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code
          at Welcome1.jButton2MouseReleased(Welcome1.java:60)
          at Welcome1.access$000(Welcome1.java:7)
          at Welcome1$1.mouseReleased(Welcome1.java:29)
          at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
          at java.awt.Component.processMouseEvent(Component.java:6263)
          at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
          at java.awt.Component.processEvent(Component.java:6028)
          at java.awt.Container.processEvent(Container.java:2041)
          at java.awt.Component.dispatchEventImpl(Component.java:4630)
          at java.awt.Container.dispatchEventImpl(Container.java:2099)
          at java.awt.Component.dispatchEvent(Component.java:4460)
          at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
          at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
          at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
          at java.awt.Container.dispatchEventImpl(Container.java:2085)
          at java.awt.Window.dispatchEventImpl(Window.java:2478)
          at java.awt.Component.dispatchEvent(Component.java:4460)
          at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
          at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
          at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
          at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
          at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
  </code></pre>