문제

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????

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top