• Post Reply Bookmark Topic Watch Topic
  • New Topic

hi

 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, please tell me how to set back ground color to the table.
waiting for reply.
regards
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean that Background color for Table Cells, you have to write your CellRenderer extending JLabel and implementing TableCellRenderer, and set background color to the Label.
 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi vijay
please send me the code if u have
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class ColorRenderer extends JLabel implements TableCellRenderer
{
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
{
setBackground(Color.BLUE);
return this;
}
}
use tableColumn.setCellRenderer(new ColorRenderer()); on each and every column in the table, so that you can have every table column colored.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!