aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to 'refresh' a JList? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to Watch "how to New topic
Author

how to 'refresh' a JList?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi all,

I have a JList:

myJList = new JList(model); //model is a DefaultListModel
myJList.setCellRenderer(new ItemRenderer());



The JList has some items that are painted (COLOR) according to a specific parameters.
The user is able to chagne a value and as a result - the color of the item should be changed accordingly.

example
1/1/2005 abc 2/1/2005 (this is painted in red)
1/1/2005 bbc 5/1/2005 (this is painted in green)
1/1/2005 fox 7/1/2005 (this is painted in green)

When the user changes it (say he changes the date) - i need to instruct the myJList to change the color - accordingly
I thought

myJList.updateUI();

will do it but I guess i was wrong.

any idea?

Thanks
peter
tito bayuadji
Greenhorn

Joined: Apr 18, 2002
Posts: 12
how about repaint()?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to 'refresh' a JList?