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
Post a Comment