Java JTable Header AddToTable(JTable tbl, Object[] obj, boolean head)

Here you can find the source of AddToTable(JTable tbl, Object[] obj, boolean head)

Description

Add To Table

License

Open Source License

Declaration

public static void AddToTable(JTable tbl, Object[] obj, boolean head) 

Method Source Code

//package com.java2s;
/**/* w  ww .jav a2 s.c  o  m*/
 * CEDP: Computer Evaluator for Dependability and Performance
 * This file is distributed under the University of Illinois Open Source
 * License. See LICENSE.TXT for details.
 */

import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

public class Main {
    public static void AddToTable(JTable tbl, Object[] obj, boolean head) {
        int size = tbl.getRowCount();
        DefaultTableModel tableModel = (DefaultTableModel) tbl.getModel();

        if (head) {
            tableModel.insertRow(0, obj);
        } else {
            tableModel.insertRow(size, obj);
        }
    }
}

Related

  1. adjustHeader(JTable table)
  2. calcHeaderWidth(int col)
  3. calcHeaderWidth(JTable table, int col)
  4. cleanHeaderCells(JTable table)