File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes getting notification from JLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getting notification from JLabel" Watch "getting notification from JLabel" New topic

getting notification from JLabel

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
during my google i read this:
Components (except JLabel) can generate events

i was surprised, but in fact couldnt find any answer to my Q:
how can i be notified when a JLabel's text change?


java amateur
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281

no one will claim that wasnt notified

before posting my Q i stood twice at API: addPropertyChangeListener, but gave up since couldnt find any 'text'
i missed the fact that could exist others:
The listener is registered for all bound properties of this class, including the following:

my actual interpretation is the following: JLabel is a bean, 'text' is also a bound property so ...

thanks a lot Michael

EDITED: i cant post the direct link to 'addPropertyChangeListener' because of javaRanch html code policies
[ June 27, 2005: Message edited by: miguel lisboa ]
I agree. Here's the link:
subject: getting notification from JLabel
It's not a secret anymore!