Example usage for javax.swing JTable doLayout

List of usage examples for javax.swing JTable doLayout

Introduction

In this page you can find the example usage for javax.swing JTable doLayout.

Prototype

public void doLayout() 

Source Link

Document

Causes this table to lay out its rows and columns.

Usage

From source file:Main.java

@SuppressWarnings("serial")
public static void setupTable(JTable jTable, TableCellRenderer tableCellRenderer, String[][] content) {

    jTable.setModel(new DefaultTableModel(content, content[0]) {
        @Override//from   ww  w . j  av a 2s. c  o m
        public boolean isCellEditable(int i, int j) {
            return false;
        }
    });

    for (int j = 0; j < jTable.getColumnModel().getColumnCount(); j++) {
        jTable.getColumnModel().getColumn(j).setCellRenderer(tableCellRenderer);
    }
    jTable.doLayout();
}