greatmajestics
greatmajestics

Reputation: 1093

TableModelListener

I am making a student record application... I want a column in it which is editable. I have attached table model listener on table and on that column i m saving all the updating values

if(table.getSelectedColumn() == 3 && table.getSelectedRow() != -1 && tme.getType() ==     TableModelEvent.UPDATE)
{
// my code here
table.cellEditAt(row,column); // this is giving me error
}

table.cellEditAt automatically calls table model event and that is producing a infinite loop... Any other method to automatically select a cell for editing????

Upvotes: 1

Views: 800

Answers (2)

camickr
camickr

Reputation: 324098

The answer was to post an SSCCE. We are not mind readers. We can't guess what your editCellAt(...) method does. If it causes a loop, then that would be because you are somehow changing the model and generating another TableModelEvent. Don't do this!

If the problem is somehow related to placing a cell in edit mode, then I would guess you need to wrap that code in a SwingUtilities.invokeLater() to make sure the processing of the original event is completed before you place another cell in edit mode.

Upvotes: 1

mKorbel
mKorbel

Reputation: 109815

please post an SSCCE that demonstate your issues, for example based on my question about Infinite loop by implements TabelModelListener linked to my answer,

Upvotes: 2

Related Questions