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.TableMod el tableModel)
{
super(resourceTag, tableModel);
}
public void createDefaultColumnsFromMo del()
{ super.createDefaultColumns FromModel( );
TableColumnModel model = getColumnModel();
columnModel.getColumn(3);
this.removeColumn(column);
}
model.removeColumn(model.g etColumn(3 ));
}
}
in my Dialog I am implementing...
protected MyTable m_tblSetMetric = null;
m_tblmdlSetMetric = new MDefaultTableModel("setMet ricLis", dataOut);
m_tblSetMetric = new MyTable("setMetricLis", m_tblmdlSetMetric);
m_tblSetMetric.createDefau ltColumnsF romModel() ;
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.g etColumn(3 ));
line then it shows all the columns...Am I missing somethign or doing wrong...
Appreciate any help...
thanks
public class MyTable extends JTable
{
public MyTable()
{
super();
}
public MyTable(java.lang.String resourceTag, javax.swing.table.TableMod
{
super(resourceTag, tableModel);
}
public void createDefaultColumnsFromMo
{ super.createDefaultColumns
TableColumnModel model = getColumnModel();
columnModel.getColumn(3);
this.removeColumn(column);
}
model.removeColumn(model.g
}
}
in my Dialog I am implementing...
protected MyTable m_tblSetMetric = null;
m_tblmdlSetMetric = new MDefaultTableModel("setMet
m_tblSetMetric = new MyTable("setMetricLis", m_tblmdlSetMetric);
m_tblSetMetric.createDefau
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.g
line then it shows all the columns...Am I missing somethign or doing wrong...
Appreciate any help...
thanks
Is coming ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Force Accepted
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange