import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class Test {
public static void main(String[] args) {
Test test = new Test();
JPanel panel = new JPanel(new GridLayout(1,0,5,5));
for(int i = 0; i < 3; i++) {
JTable table = new JTable(test.getModel());
Dimension d = table.getPreferredSize();
d.height = 175;
table.setPreferredScrollableViewportSize(d);
panel.add(new JScrollPane(table));
}
JOptionPane.showMessageDialog(null,
new JScrollPane(panel), "",
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);
}
};
}
}