Hi guys,

I am trying to create a cell renderer that will set a background imagefor cells in a JTable I have created, depending on the data inside each cell.

I think I will be able to do the rest, but for now I just want to be able to put background images inside a cell using my cell renderer (right now I am only managing to change the background color).

anyone have an idea how to do this ?

public class MyImageCellRenderer extends DefaultTableCellRenderer {
 
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
         boolean isFocused, int row, int column) {
    	
    	 Component cell = super.getTableCellRendererComponent
         (table, value, isSelected, isFocused, row, column);
    	 

     cell.setBackground(Color.black);		
    			
return cell;
    			
  }

http://www.daniweb.com/forums/thread252329.html

refer this link..you can get idea..

My problem is mainly putting the image in the background behind the data in my JTAble, rather than rendering the image, which I think I can do.

Thanks

dani

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.