Link to home
Start Free TrialLog in
Avatar of manishkp
manishkp

asked on

Trying to hide columns while using Default table Model - JTable

I have extended JTable as follows...

public class MyTable extends JTable
{
    public MyTable()
    {
        super();
    }
    public MyTable(java.lang.String resourceTag, javax.swing.table.TableModel tableModel)
    {
        super(resourceTag, tableModel);
    }

    public void createDefaultColumnsFromModel()
    {       super.createDefaultColumnsFromModel();
        TableColumnModel model = getColumnModel();
columnModel.getColumn(3);
            this.removeColumn(column);
        }
        model.removeColumn(model.getColumn(3));
       
    }
}

in my Dialog I am implementing...

protected MyTable m_tblSetMetric = null;

m_tblmdlSetMetric     =  new MDefaultTableModel("setMetricLis", dataOut);
m_tblSetMetric           =   new MyTable("setMetricLis", m_tblmdlSetMetric);
m_tblSetMetric.createDefaultColumnsFromModel();
MTablePane tp           =   new MTablePane(12, true, null, (MTable)m_tblSetMetric, m_tblmdlSetMetric);
......

I am not getting any exception but the dialog doesn't show me the column names that I am trying to pull from properties file. If I comment out

model.removeColumn(model.getColumn(3));


line then it shows all the columns...Am I missing somethign or doing wrong...
Appreciate any help...
thanks

Avatar of Ovi
Ovi

Is coming ...
ASKER CERTIFIED SOLUTION
Avatar of Ovi
Ovi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange