Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3598

Re: should I use java.awt.* only or also use javax.swing in applets?

From "John B. Matthews" <nospam@nospam.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: should I use java.awt.* only or also use javax.swing in applets?
Date 2011-05-05 17:20 -0400
Organization The Wasteland
Message-ID <nospam-A3001A.17200805052011@news.aioe.org> (permalink)
References <ba0c3c4d-cf9e-4b1b-82a8-30b84405b915@17g2000prr.googlegroups.com> <h%kwp.57959$0s5.42695@newsfe17.iad> <nospam-85654B.12160105052011@news.aioe.org> <ipun5u$2v1$1@dont-email.me>

Show all headers | View raw


In article <ipun5u$2v1$1@dont-email.me>, markspace <-@.> wrote:

> 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).

I'll have to throw in an "amen" and note that the forthcoming version 7 
appears to have quietly deprecated the thread-safety of several methods, 
including JTextArea's append().

<http://download.oracle.com/javase/6/docs/api/javax/swing/JTextArea>

Related bugs are notoriously protean and difficult to reproduce; 
diligence is the only defense.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

should I use java.awt.* only or also use javax.swing in applets? steveh44 <steve_h44@yahoo.com> - 2011-05-04 14:34 -0700
  Re: should I use java.awt.* only or also use javax.swing in applets? Knute Johnson <nospam@knutejohnson.com> - 2011-05-04 16:07 -0700
    Re: should I use java.awt.* only or also use javax.swing in applets? "John B. Matthews" <nospam@nospam.invalid> - 2011-05-05 12:16 -0400
      Re: should I use java.awt.* only or also use javax.swing in applets? markspace <-@.> - 2011-05-05 10:35 -0700
        Re: should I use java.awt.* only or also use javax.swing in applets? "John B. Matthews" <nospam@nospam.invalid> - 2011-05-05 17:20 -0400
          O/T: Awesome vocabulary (Was: should I use java.awt.* only or also use javax.swing in applets?) Lew <noone@lewscanon.com> - 2011-05-05 17:28 -0400
            Re: O/T: Awesome vocabulary (Was: should I use java.awt.* only or also use javax.swing in applets?) Tom Anderson <twic@urchin.earth.li> - 2011-05-05 23:31 +0100
              Re: O/T: Awesome vocabulary (Was: should I use java.awt.* only or also use javax.swing in applets?) Jim Janney <jjanney@shell.xmission.com> - 2011-05-05 17:02 -0600
          Re: should I use java.awt.* only or also use javax.swing in applets? markspace <-@.> - 2011-05-05 20:05 -0700
  Re: should I use java.awt.* only or also use javax.swing in applets? Lew <noone@lewscanon.com> - 2011-05-04 19:10 -0400
  Re: should I use java.awt.* only or also use javax.swing in applets? Roedy Green <see_website@mindprod.com.invalid> - 2011-05-05 16:47 -0700
  Re: should I use java.awt.* only or also use javax.swing in applets? Andrew Thompson <andrewthommo@gmail.com> - 2011-05-06 03:25 -0700
    Re: should I use java.awt.* only or also use javax.swing in applets? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-05-06 19:06 +0200

csiph-web