import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.table.JTableHeader;
public class Main {
public static void main(String[] argv) throws Exception {
int rows = 10;
int cols = 5;
JTable table = new JTable(rows, cols);
JTableHeader header = table.getTableHeader();
JPanel container = new JPanel(new BorderLayout());
// Add header in NORTH slot
container.add(header, BorderLayout.NORTH);
// Add table itself to CENTER slot
container.add(table, BorderLayout.CENTER);
}
}
|