• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable - make cell blink

 
Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the situation:
i'm new with JTable..
i get data from database.
then, i put it on JTable.
the next time, i get the data, i want to compare it with the one in the JTable.
if there is a change, i want to make the changed cell to blink.
question:
how can i dynamically build the JTable?.
how can i get specific cell value?.
how can i make specific cell to blink?....
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ariffin,
You can dynamically build your table with implementing a TableModel or extending from DefaultTableModel.
This model you can also use to get a specific cell value, because the table itself needs it too.
You need do implement the method getValue(int row, int col).
The blinking you have to do with a TableCellRenderer. In your implementation you could create a thread, which changes the color.
If you are starting with JTable, then you should have a look to the Swing tutorial from SUN.
Hope this helps a bit.
Rene
 
Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've already been the sun's swing tutorial....
but, is there any online tutorial, that will teach me, exactly as i want?...
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
here is an exact link to the table section of the swing tutorial.
TableTutorial
I don't know about any other tutorial, but I never searched for it. For me, the swing tutorial was enough. Ok, it will not teach you, how to make a cell blinking, but it teaches you to write your own TableCellRenderer. As soon as you have this, blinking shouldn't be the problem. Also the TableModel task belongs to the content. So in my opinion, you won't have a better tutorial. At least they have lots of examples.
 
Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks man..
u help me a lot...
i'll looking forward for that tutorial...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!