I want to develope stock ticker application in java. I dont know how to update JTable's specific cell's backcolour. In my application one thread running in background which randomly update's cell's text which is integer. I want to change cell's colour on the time of update. If previous cell's value is less than new value than cell's background colour shold become blue otherwise it would become blue. I am using my own cell renderer for this task. I am able to change cell's colour but on next update all the cell's colour change to default. I want that previously changed cell colour should remain same on next update. Please help me if u know the answer. Thanx in Advance.

9 Years
Discussion Span
Last Post by Ezzaral

I don't know who this "u" person is, but simply put that condition in your cell renderer. If you can update it once, you can certainly write a condition that determines if it should be updated again or stay the same.


I have tried the same but whenever table is repainted the old values are also set to default is there a way to remember previous stat of the table


That depends entirely on what determined the previous state of the table. Your cell renderer just needs enough info to determine, based upon it's value and location, how you want to render it. Not knowing a thing about how you are storing or updating the data that drives that decision, I can't tell you exactly how that should be coded.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.