Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: should I use java.awt.* only or also use javax.swing in applets? Date: Thu, 05 May 2011 10:35:48 -0700 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 5 May 2011 17:35:59 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="TiFW3uI3t2QGJqpfngECPg"; logging-data="3041"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183oilEvvN2urqpWE4W2Cvj39Sn51VFudQ=" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:aEj49/noa6iq4uwy00rI6h1b9sQ= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3574 On 5/5/2011 9:16 AM, John B. Matthews wrote: > > Somehow I'd previously overlooked the need to construct the GUI on the > EDT for JApplets. Thanks for the reminder! Don't forget this applies to all calls to your JApplet that you didn't initiate yourself. For example, init(), start(), stop() and destroy(): you definitely should access any UI component they interact with on the EDT. This includes destroying UI components and shutting down, not just creating the GUI. Also, don't forget thatany other JComponent method could be called by JavaScript, or in fact JavaScript could call any public method at all that your applet declares. If you're being really defensive, you might want to override all public methods that access the GUI or are not thread safe, and verify you are in fact being called on the EDT (or do whatever else is needed to assure/detect thread safety).