Announcement Announcement Module
No announcement yet.
Table with flashing cells... Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Table with flashing cells...

    Dear All,

    Here is the latest wish from my users... I'd like to find either a library, a generic way or some "official" way for doing it in Spring RC.

    Users want a JTable to be updated in real-time but the changing fields to "flash" for a few seconds (and have the ability to flash green if the cell is a number and it is up, otherwise red if new value less). If it is a text field, just flash for a couple of sec.

    By "flashing", they mean the background color/colour to change for 2 seconds and then back to what it was.

    So, here is the scenario:
    - We have a GlazedList "myList" in a GlazedTableModel and a JTable. Everything displays fine.
    - The data changes and we have a new java.util.Collection of data.
    - We do this: myList.cleas() and myList.addAll(theCollection) and the data is replaced...

    Now how to add this "flashing" business... There will be a need to compare the new list with the old one and decide what to do..

    Any suggestion? In pure Swing? In Spring RC?

    Many thanks


  • #2

    If you need the entire row, then I would simply override the prepareRenderer method on the jtable to set the background for the given cell using a var to switch from flashColor, to backGround color. If its just one cell i would just write a custom TableCellRenderer. Then use glazed list to update the contents, flip bit, update contents, flip bit...
    Last edited by mlavwilson2; Mar 17th, 2006, 03:31 PM.


    • #3
      Hi Matt,

      Thanks for the info, I've found a way with Decorator pattern, it is fairly generic which is cool. Unfortunately, some of the GlazedTableModel methods are protected and this forces me to extend the class and provide methods with a different signature for the column property names... Current GlazedTableModel is a bit too strict...

      I may post a solution in a while but if anybody has a great solution, that'd be good.