Florian Ruh
Florian Ruh

Reputation: 110

Java: break focus cycle in jtable

In my JTable, I want to edit all relevant cells like in Excel.

I implemented that ENTER stops editing the cell and transfers focus to the next cell. However, when I hit ENTER in the last cell, the focus cycle makes me jump to the fist cell. But I want to continue outside the table and set focus to a JButton.

How can I break this cycle?

Upvotes: 3

Views: 369

Answers (1)

trashgod
trashgod

Reputation: 205785

JTable is not a spreadsheet, but setCellSelectionEnabled() should allow you to proceed. Use setDefaultButton() as required, for example.

Addendum: In addition to setDefaultButton(), you can evoke any desired action in your custom Action, as shown here.

Upvotes: 3

Related Questions