/* (swing1.1.1beta2) */ //package jp.gr.java_conf.tame.swing.examples; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; import javax.swing.table.*; /** * @version 1.0 06/19/99 */ public class AnimatedIconTableExample extends JFrame { public AnimatedIconTableExample(){ super( "AnimatedIconTable Example" ); final Object[][] data = new Object[][]{ {new ImageIcon("images/3-40.gif"),new ImageIcon("images/3-119.gif")}, {new ImageIcon("images/3-41.gif"),new ImageIcon("images/3-6.gif")}}; final Object[] column = new Object[]{"Boy and Girl","Dog and Cat"}; AbstractTableModel model = new AbstractTableModel() { public int getColumnCount() { return column.length; } public int getRowCount() { return data.length; } public String getColumnName(int col) { return (String)column[col]; } public Object getValueAt(int row, int col) { return data[row][col]; } public Class getColumnClass(int col) { return ImageIcon.class; } }; JTable table = new JTable( model ); table.setRowHeight(50); setImageObserver(table); JScrollPane pane = new JScrollPane(table); getContentPane().add(pane); } private void setImageObserver(JTable table) { TableModel model = table.getModel(); int colCount = model.getColumnCount(); int rowCount = model.getRowCount(); for (int col=0;col