Detecting Tab in JComboBox used as cell Editor

C

cjaouhar

I have a JTable where one of the column could contains differents cell
editor (mainly JTextField and JComboBox). When an editable cell has
focus, and the tab key is pressed, I would like to set focus on the
next editable cell.

All works when tabbing from JTextField. But when a JComboBox is reached
and tab is pressed, I am not able to detect the tab key. Any idea?

My code looks like this...

JComboBox aWidgetCombo = new JComboBox() {
public void processKeyEvent(KeyEvent ke) {
if (ke.getKeyChar() == KeyEvent.VK_TAB) {
if (ke.getID() == KeyEvent.KEY_TYPED) {
setFocusOnNextCell(row,column,ke); //method that find
the next cell to get focus
}
ke.consume();
} else {
super.processKeyEvent(ke);
}
}
};
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top