Example usage for javax.swing.table TableColumn TableColumn

List of usage examples for javax.swing.table TableColumn TableColumn

Introduction

In this page you can find the example usage for javax.swing.table TableColumn TableColumn.

Prototype

public TableColumn(int modelIndex, int width, TableCellRenderer cellRenderer, TableCellEditor cellEditor) 

Source Link

Document

Creates and initializes an instance of TableColumn with the specified model index, width, cell renderer, and cell editor; all TableColumn constructors delegate to this one.

Usage

From source file:org.zaproxy.zap.extension.httppanel.view.paramtable.HttpPanelParamTableView.java

@Override
public void setEditable(boolean editable) {
    if (isEditable != editable) {
        if (isEditable) {
            table.getColumnModel().removeColumn(table.getColumnModel().getColumn(3));
        } else {/* ww  w.  j  a  v a  2s. c o  m*/
            TableColumn column = new TableColumn(3, 150, new ComboBoxCellRenderer(comboBoxAddIns),
                    new DefaultCellEditor(comboBoxAddIns));
            column.setPreferredWidth(150);
            column.setMaxWidth(150);
            table.addColumn(column);
        }

        isEditable = editable;

        httpPanelTabularModel.setEditable(editable);
    }
}