• Post Reply Bookmark Topic Watch Topic
  • New Topic

searching a JTable that has editor  RSS feed

 
Osama Al-Haj Hasan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable, the editor of the cells is JComboBox, i want to search for a value in the cells, once i found it, i want the cell to be shaded in a different color in order to notice it easily, How can i do that.
Appreciate Your Help
Thanks alot.
 
clio katz
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not sure what overrides you have in place, but best way to do this is probably to write a custom cellrenderer. One way might be to override 'setValue' for the colorable columns. (Another way, not discussed here, might be to override getTableCellRendererComponent in the component)
if your colorable cells are JLabels, for example, you could test the combobox value, and setForeground(someColor) to the appropriate color for the cell.
very generally speaking, the renderer might look like:


hth
[ May 04, 2004: Message edited by: clio katz ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!