Re: Jlist items not appearing occasionally
- From: "Allan Bruce" <amb@xxxxxxx>
- Date: Fri, 20 Jan 2006 02:27:09 -0000
>> It cannot be final as the contents of all of the Strings are unknown at
>> compile-time :(
>
> final (as applied to a local variable) means that it can only be assigned
> once. As a local variable, that will have to be during that run of the
> method.
>
> public void addUser(User user) {
> assert !java.awt.EventQueue.isDispatchThread();
> final String name = user.getName();
> java.awt.EventQueue.invokeLater(new Runnable() {
> public void run() {
> assert java.awt.EventQueue.isDispatchThread();
> list.addElement(name);
> }
> });
> }
>
> Tom Hawtin
Doh, of course, I feel a little stupid now! Anyway, so the above code could
be executed from any thread, other than the EDT?
Thanks
Allan
.
- References:
- Jlist items not appearing occasionally
- From: Allan Bruce
- Re: Jlist items not appearing occasionally
- From: Thomas Hawtin
- Re: Jlist items not appearing occasionally
- From: Allan Bruce
- Re: Jlist items not appearing occasionally
- From: Thomas Hawtin
- Re: Jlist items not appearing occasionally
- From: Allan Bruce
- Re: Jlist items not appearing occasionally
- From: Thomas Hawtin
- Jlist items not appearing occasionally
- Prev by Date: Re: Jlist items not appearing occasionally
- Next by Date: What it the type of the Class without modifier
- Previous by thread: Re: Jlist items not appearing occasionally
- Next by thread: Re: if-else statements
- Index(es):
Relevant Pages
|