I am adding a combobox to the 3rd column of a table so..every time a new row is added it will create a new combobox and adds items from those in vector1
TableColumn ProfileCol = Table.getColumnModel().getColumn(3);
ProfileCol.setCellEditor(new tableList(vector1));
Here tableList is a a below mentioned class that extends DefaultcellEditor and its constructor method is
public tableList(java.util.Vector v) {
super(new JComboBox(v));
My problem is If I write an action even like
Table.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent evt) {
int row = Table.rowAtPoint(evt.getPoint());
int col = Table.columnAtPoint(evt.getPoint());
if (row >= 0 && col ==3) {
}
}
});
it is not getting triggered..
Please help with this.
every time I add a new row to the table a new combobox is generated..so how can I write an action listern to them
You should NOT be using an ActionListener.
You have three options:
setValue(...)
method of the TableModel to do your processing