hello!

i have to create Jtable with two columns one is for data(string)and another one is for animated gif file ...

how can i write a gif and data in two columns respectively....

please give any sample code snippet...

I haven't tried that before but my first guess would be this.
If you see tha API for the JTbale model, there is a method called setModel that takes as argument a TableModel. Look at the class that implements that inteface: DefaultTableModel.
The method addRow takes as argument an array Of Objects. So you can do this:

// initialiaze them somewhere globally.
DefaultTableModel dtm = new ....  // see the API
JTable jTable = new ... // see the API
jTable.setModel(dtm);

...
...

Object [] obj = new Object[2];
obj[0] = "String value";
ojb[1] = new Icon();

dtm.addRow(obj);

Remeber when you get the values from the cells using the get Methods of the tableModel, you will need to cast them to the correct class

String s = (String)dtm.getValueAt(i,0);
Icon ic = (Icon)dtm.getValueAt(i,1);

And one last thing. The Icon class might not be correct. You need to check the API in order to find the correct class for creating image instances.

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.