This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi All, I have a JList which shows a list of files. I can programmatically grab the selected files and loop through each file - performing operations on it. What I want to do is change the background of a file once it has been processed to show the status of the file (Green = OK, Red = Fail). I am storing the index of the files in 2 ArrayLists - one for the good files and one for the bad files. I have created the ListCellRenderer which will set the appropriate background depending on whether a file is in one of the ArrayLists or not. The problem is that the custom ListCellRenderer only updates the JList AFTER all files have been processed. I want the JList to be updated after each individual file has been processed. Is this possible? I have added Thread.yield() and Thread.sleep(5000) and JList.repaint() in the loop that processes each file - but these do not work. Can anyone help me? Many thanks, Fintan PS Here is the code that loop thro' each file :
Here is the getListCellRendererComponent method of my ListCellRenderer :