Swing JTable: tweak "enter", so it acts just like double-clicking a row

I have brain cramps - how do I set it JTableso that the enter key acts like a double click on a line?

The “good” way to iterate over is to call JTable.getInputMap()and JTable.getActionMap()and add a new action name and a new Actionone that double-clicks. But there has to be a better way, I think ....

+3
source share
1 answer

Your "brute force" method is the norm, and Peter Lang KeyListeneris an alternative. From the Sun Talk on Key Binding :

. , , , . , , . - , , , ( Action) , . , , . , , , .

+1
source

Source: https://habr.com/ru/post/1730902/


All Articles