I have created a custom JComboBox
with a custom popup that implements the KeyListener
. I wanted an item to be selected from the popup of the cmbBox on the press of either Tab
or Enter
hence I set the setFocusTraversalKeysEnabled(false)
for both the combobox and the popup.
The problem with this approach is that now I have to add another KeyListener
to the combobox when I use it in containers so as to shift the focus.
Can I fire a transfer focus event(hypothetically) or something like that within my custom JComponent which will transfer the focus in its parent component so that I dont have to add key listeners everywhere I use it. I have used transferFocus()
but it is not transferring the focus.
I have not dirtied my hands on Key Bindings yet but is there a key binding to transfer the focus?
Thanks
I am trying to recreate a sscce but its proving difficult. Please bear.