Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As discussed in <a href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html" rel="nofollow noreferrer"><em>Initial Threads</em></a>, "An initial thread schedules the GUI creation task by invoking <code>invokeLater</code> or <code>invokeAndWait</code>." You are trying to both play a sound and operate a GUI on the same initial thread. Instead, start the sound on the initial thread and construct the GUI on the EDT, as shown <a href="https://stackoverflow.com/a/10670509/230513">here</a>, or start a separate thread to play the sound, as shown <a href="https://stackoverflow.com/a/12548978/230513">here</a>.</p> <blockquote> <p>I don't want to use AWT dispatch thread.</p> </blockquote> <p>Right, you don't want to use the AWT event dispatch thread to play sound, but you <em>must</em> use it for the GUI.</p> <blockquote> <p>The question is somewhat unanswered. The playing of sound is light, so must be handled by single EDT.</p> </blockquote> <p>I can only speculate that using a different component changed the timing enough to affect the result on your platform. Until the program is correctly synchronized, there's always some environment in which it will work and some in which it will fail. The essential rule is this: don't block the EDT. See also this <a href="https://stackoverflow.com/a/7809480/230513">answer</a>, this <a href="https://stackoverflow.com/a/26318/230513">answer</a> and the <a href="https://stackoverflow.com/tags/javasound/info">Java Sound</a> tag.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload