Re: Forcing a JList to refresh one cell
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Wed, 25 Jan 2006 21:51:09 GMT
"Paul Tomblin" <ptomblin+netnews@xxxxxxxxx> wrote in message
news:dr8r9d$2mo$1@xxxxxxxxxxxxxxxxxxxx
>I have a JList where each item in the list is rendered by a
> ListCellRenderer. Among other things, the ListCellRenderer shows a
> JProgressBar that is updated by an outside event. The item itself has an
> observer to notice that it has been updated, but other than calling
> repaint on the whole JList, I can't seem to make it repaint the cell that
> changed.
Hopefully, you have a javax.swing.ListModel representing all the items
in your list. This ListModel should be keeping track of its
javax.swing.event.ListDataListeners, of which the JList itself is probably
one of the listeners.
You should send your ListDataListeners a "contentsChanged" notification
and provide it with a javax.swing.event.ListDataEvent to tell it
specifically which elements has changed in the list.
See:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/ListModel.html
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/event/ListDataListener.html
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/event/ListDataEvent.html
- Oliver
.
- References:
- Forcing a JList to refresh one cell
- From: Paul Tomblin
- Forcing a JList to refresh one cell
- Prev by Date: Forcing a JList to refresh one cell
- Next by Date: Re: Forcing a JList to refresh one cell
- Previous by thread: Forcing a JList to refresh one cell
- Next by thread: Re: Forcing a JList to refresh one cell
- Index(es):
Relevant Pages
|
|