I have registered a JTextField to a KeyListener class that causes a JPopupMenu to appear when certain letters are typed into the textfield. I want to be able to just carry on typing if I don't want to choose any of the options on the menu, but at the moment I have to manually click the focus back into the textfield to make the popupmenu disappear.
So I want the popupmenu to disappear as soon as I make another keystroke.
Does anyone know a way I could do this?
I looked at the api for popupmenus and see there is a firepopupmenucancelled method. Does anyone know if the keylistener is still active while the popupmenu is up? (ie is it registering other keystokes but just not displaying anything, or is it just shut down for some reason while the popupmenu is displayed). Because if it is still active, then maybe the firepopupmenucancelled is the way forward. I'll give it a go, but would be grateful for any tips or revelatory info.
I have just put a println message in my keylistener class that prints out a message every time I touch a key. It wouldn't print out anything while the popup menus were up! Hmmm... [ December 11, 2008: Message edited by: Joe Lemmer ]