Re: Forcing a JList to refresh one cell



In a previous article, Vova Reznik <address@xxxxxxxx> said:
>Paul Tomblin wrote:
>> 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.
>>
>Look in
>javax.swing.AbstractListModel
>and its method
>protected void fireContentsChanged(Object, int, int)
>
>Practically you'll need to create your own model extends
>AbstractListModel if you don't have one.

In order to do that, the item would have to propogate the fact that it
changed up to the ListModel, and then the ListModel would have to
fireContentsChanged. I was hoping there was a direct way, but I guess
that will do.



--
Paul Tomblin <ptomblin@xxxxxxxxx> http://xcski.com/blogs/pt/
You had me at
print("Hello World\n");
.



Relevant Pages

  • Re: Forcing a JList to refresh one cell
    ... > ListCellRenderer. ... > JProgressBar that is updated by an outside event. ... > repaint on the whole JList, I can't seem to make it repaint the cell that ... You should send your ListDataListeners a "contentsChanged" notification ...
    (comp.lang.java.gui)
  • Forcing a JList to refresh one cell
    ... ListCellRenderer. ... JProgressBar that is updated by an outside event. ... repaint on the whole JList, I can't seem to make it repaint the cell that ... I think I'd like to see a Simpsons episode starting up with Bart Simpson ...
    (comp.lang.java.gui)
  • Re: Forcing a JList to refresh one cell
    ... 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. ... javax.swing.AbstractListModel and its method protected void fireContentsChanged(Object, int, int) ...
    (comp.lang.java.gui)