JLabel.setText

S

Sam Takoy

In my code (will provide an example if necessary), I have a JLabel that
doesn't change it's content after label.setText("new-content"). The text
does change after I resize the parent JInternalFrame. I have never
encountered this behavior before and I am wondering what this could be
caused by...

Thank you in advance,

Sam
 
K

Knute Johnson

In my code (will provide an example if necessary),

Always a good idea.

I have a JLabel that
doesn't change it's content after label.setText("new-content"). The text
does change after I resize the parent JInternalFrame. I have never
encountered this behavior before and I am wondering what this could be
caused by...

Are you calling setText() from the EDT?

Are you blocking the EDT?
 
R

Roedy Green

In my code (will provide an example if necessary), I have a JLabel that
doesn't change it's content after label.setText("new-content"). The text
does change after I resize the parent JInternalFrame. I have never
encountered this behavior before and I am wondering what this could be
caused by...

The usual problem is you tie up the EDT thread somehow (perhaps a
sleep). It never gets a chance to handle the repaint event.
--
Roedy Green Canadian Mind Products
http://mindprod.com

Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, “How would I develop if it were my money?” I’m amazed how many theoretical arguments evaporate when faced with this question.
~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
 
R

Roedy Green

Knute, what is EDT?

Oh dear. You absolutely have to understand the EDT to use Swing.

See http://mindprod.com/jgloss/swing.html
and follow the links about threads.
--
Roedy Green Canadian Mind Products
http://mindprod.com

Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, “How would I develop if it were my money?” I’m amazed how many theoretical arguments evaporate when faced with this question.
~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
 
E

Eric Sosman

Knute, what is EDT?

He probably means one or more of

* Eastern Daylight Time, the civil time standard now in
effect where I live.

* A text/source editor for (Open)VMS.

* Eau de toilette, a range of perfume strengths.

* Ensconce Data Technology, maker of data-destruction products.

* Estelle Development Toolkit, a suite of tools for formal
specification and analysis of communicating systems.

So, choose whichever of these makes the most sense in context.

Oh, and there's a faint chance that he meant the Event
Dispatching Thread on which most Swing activities occur.

It's long been recognized that three-letter acronyms (TLA's)
are in limited supply, and that most of them have already been
used several times. There's a move afoot to increase the
supply of TLA's by making them longer, so you can expect to see
four- and five-letter TLA's any day now.
 
M

markspace

Tony said:
Thanks, Arne! I didn't know "Event_dispatching_thread" can be called as
EDT.


First, it's Event Dispatch Thread, with no under-bars. As in three
normal English words in a normal English language sentence. People who
write English don't_normally_go_around_putting_a_lot_of_under-bars in
their sentences.

Second, it's been called the EDT by Sun for a long time, so I guess you
haven't been paying attention. For example here's some release notes by
Sun for JDK 1.5 that use the acronym EDT. Note these release notes are
three years old:

http://java.sun.com/j2se/1.5.0/ReleaseNotes.html
 
R

Roedy Green

So when do people start using EDT to refer to
"Event_dispatching_thread"?

I think the term came into common use when Swing first came out. AWT
attempted to be thread safe without programmer awareness.
--
Roedy Green Canadian Mind Products
http://mindprod.com

Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, “How would I develop if it were my money?” I’m amazed how many theoretical arguments evaporate when faced with this question.
~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
 
R

Roedy Green

Thanks, Arne! I didn't know "Event_dispatching_thread" can be called as EDT.

Again the Java glossary is your friend for clearing up such mysteries.

see http://mindprod.com/jgloss/edt.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, “How would I develop if it were my money?” I’m amazed how many theoretical arguments evaporate when faced with this question.
~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
 
A

Arne Vajhøj

Thanks, Arne! I didn't know "Event_dispatching_thread" can be called as
EDT.

It is known as EDT.

Most people will know what EDT is but have to look it up to verify
what it is an abbreviation of.

Arne
 
A

Arne Vajhøj

I think the term came into common use when Swing first came out. AWT
attempted to be thread safe without programmer awareness.

EDT is an AWT concept.

Arne
 
T

Tony Yan

First, it's Event Dispatch Thread, with no under-bars. As in three
normal English words in a normal English language sentence. People who
write English don't_normally_go_around_putting_a_lot_of_under-bars in
their sentences.

Sorry about that. It's like that because I copied it directly from the
wiki link.
Second, it's been called the EDT by Sun for a long time, so I guess you
haven't been paying attention. For example here's some release notes by
Sun for JDK 1.5 that use the acronym EDT. Note these release notes are
three years old:

http://java.sun.com/j2se/1.5.0/ReleaseNotes.html

Oh, I didn't read documents like release notes. So what part of such
documents do you think most useful? Thanks!

Tony
 
L

Lew

markspace said:
For example here's some release notes by
Sun for JDK 1.5 that use the acronym EDT. Note these release notes are
three years old:

http://java.sun.com/j2se/1.5.0/ReleaseNotes.html

That site contains release notes for all subreleases of Java 5. Java 5 first
appeared in September of '04.

<http://en.wikipedia.org/wiki/Java_version_history>

There's no reason to prefer Java 5 over Java 6, though as a practical matter
many (usually expensive) platforms are still not up to the most recent Java.
If forced back to Java 5, there's no real reason to lament the lack of Java 6
either.

Now to have to go back to 1.4, that's a different story!

It's hard to know when the acronym "EDT" first became widely used, but I'd
guess about five minutes after the term "event dispatch thread" was promulgated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top