import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.Graphics;
public class TabbedDemo{
public static void main(String[] args){
JFrame frame=new JFrame("Tabel");
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
ImageTable table=new ImageTable(15,3);
for(int i=0;i<table.getRowCount();i++){
for(int j=0;j<table.getColumnCount();j++){
table.setValueAt("("+i+","+j+")",i,j);
}
}
JScrollPane pane=new JScrollPane(table);
frame.getContentPane().add(pane);
frame.pack();
frame.show();
}
}
class ImageTable extends JTable{
ImageIcon image=new ImageIcon("1.jpg");
public Component prepareRender(TableCellRenderer render,int row,int column){
Component c=super.prepareRenderer(render,row,column);
if(c instanceof JComponent)
((JComponent)c).setOpaque(false);
return c;
}
public void paint(Graphics g){
setOpaque(false);
Dimension d=getSize();
for(int x=0;x<d.width;x+=image.getIconWidth())
for (int y=0;y<d.height;y+=image.getIconHeight())
g.drawIamge(image.getImage(),x,y,null,null);
super.paint(g);
}
}