I have using following code over jdk 6.0 but after first round it doesnt work ....

if(table.getRowCount() -1 == table.getSelectedRow())
table.editCellValues(0,columnno);
else 
table.editCellValues(table.getSelectedRow(),columnno);

These lines are in mouse clicked method... Problem is when it reaches to end, and when fw button is pressed it jumps to another column.... Any Suggestions;.....

Recommended Answers

All 9 Replies

Try something like this

if((table.getRowCount() - 1) == table.getSelectedRow())

Sorry, i forgot to mention the brackets.... Still the same problem....

Could you provide us with a little more info? What do you want to do? Show us some more code

Well i want to edit a cell and when a user press enter next cell automatically selected in edit mode.... Its just a name entering form , when data is entered in one cell cursor moves to next.

there any Bug with TableCellEditor, some your mistake, post a runnable code that demonstrated your issue, because your code works in my hands as I expected

if(table.getRowCount() >0)
if(table.getSelectedRow() == (table.getRowCount() - 1))	
table.editCellAt(0,3);
else
table.editCellAt(table.getSelectedRow()+1,3);

Well its the code in public void keyReleased(KeyEvent ke)

And its not working, i will post a video to make it more clear... Problem is it select next cell for edit but when it reaches to end it select the first row and after VK_ENTER it move from column 3 to 4, Thats my problem...

I just found table model listener.... And it solved a great deal of my problem. But Still i cant select a new cell for updation, each cellEditAt call tablemodelevent function call which iterate and generate a error... Any Help Regarding to this...

if(table.getSelectedColumn() == 3 && table.getSelectedRow() != -1 && tme.getType() == TableModelEvent.UPDATE)
table.editCellAt(table.getSelectedRow() + 1, 0);			{

Sorry, but i thought no answers from here so i posted some where to get my answer....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.