import javax.swing.*;
import javax.swing.table.*;
public class Test {
public static void main(String[] args) {
Test test = new Test();
JTable table = new JTable(test.getModel());
JOptionPane.showMessageDialog(null,
new JScrollPane(table), "",
JOptionPane.PLAIN_MESSAGE);
}
private AbstractTableModel getModel() {
return new AbstractTableModel() {
// You must specify at least these 3 methods.
// See comments in AbstractTableModel api.
public int getRowCount() { return 10; }
public int getColumnCount() { return 4; }
public Object getValueAt(int row, int col) {
return String.valueOf((row+1)) + (col+1);
}
};
}
}