I have a JCombobox
in my code. I have added the FocusLost event
. But it didn't fired anyway. I have tried lots of time but didn't find solution.
jcbItemType.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
jcbItemTypeFocusLost(evt);
}
});
private void jcbItemTypeFocusLost(java.awt.event.FocusEvent evt)
{
// TODO add your handling code here:
System.out.println("name=" + ((Component) evt.getSource()).getName());
System.out.println("index=" + jcbItemType.getSelectedIndex());
}
But nothing is printed in console. Please suggest me what I am doing wrong.
itemStateChanged
but it is problematic for my purpose and hence i want to use FocusLost event. Your example didn't work for me although you have comment as //works for editable JComboBox too. But it isn't working for me. Please advise. I am searching it for long time. – Digestive