All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.barrybecker4.ui.table.TableBase Maven / Gradle / Ivy

There is a newer version: 1.7
Show newest version
/** Copyright by Barry G. Becker, 2000-2011. Licensed under MIT License: http://www.opensource.org/licenses/MIT  */
package com.barrybecker4.ui.table;

import javax.swing.*;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableModel;
import java.util.List;

/**
 * This represents a generic table, with a set of columns and tooltips for those column headers.
 *
 * @author Barry Becker
 */
public abstract class TableBase {

    protected JTable table_;

    /** information about each column and its header. */
    protected TableColumnMeta[] columnMeta_;

    public TableBase() {
    }

    /**
     * Constructor
     */
    public TableBase(List rows, String[] columnNames) {

        initColumnMeta(columnNames);
        initializeTable(rows);
    }

    /**
     * constructor
     * @param rows to initialize the rows in the table with.
     */
    public TableBase(List rows, TableColumnMeta[] columnMeta) {
        columnMeta_ = columnMeta;
        initializeTable(rows);
    }

    protected void initColumnMeta(String[] columnNames) {
        TableColumnMeta[] columnMeta = new TableColumnMeta[columnNames.length];
        for (int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy