java - how to focus empty combobox -


in project, have empty combobox want populate after clicking on it.

combocurrent = new jcombobox<string>();      combocurrent.setbounds(265, 181, 80, 20); add(combocurrent); combocurrent.seteditable(true); combocurrent.setselecteditem(null);  combocurrent.addactionlistener(new actionlistener() {     public void actionperformed(actionevent e) {         // todo populate here         system.out.println(e);     } }); 

but somehow action listener not work here. there way listen first click on combobox while still empty?

actionlistener invokes when press enter key. first clicking recommend use focuslistener or mouselistener on jcombobox.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -