import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class TryIt {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null,
new JScrollPane(new MyPanel()), "",
JOptionPane.PLAIN_MESSAGE);
}
}
class MyPanel extends JPanel {
public MyPanel() {
super(new GridLayout(1,0,5,5));
for(int i = 0; i < 3; i++) {
JTable table = new JTable(new MyTableModel());
Dimension d = table.getPreferredSize();
d.height = 175;
table.setPreferredScrollableViewportSize(d);
add(new JScrollPane(table));
}
}
}
class MyTableModel extends AbstractTableModel {
public int getRowCount() { return 10; }
public int getColumnCount() { return 4; }
public Object getValueAt(int row, int col) {
return String.valueOf((row+1)) + (col+1);
}
}