i am using two combo box in same program and i am adding both to itemListener class. when the user selects the the item in combo box i need to know from which combo box he is selecting.. based on that i will perform some action. I got struck here. Help me.
About your question, you need 2 item listeners, one listener for each combo box. If you don't whatever thing you do with the first combo box is also done for the 2nd combo box... and you don't want that.
About your question, you need 2 item listeners, one listener for each combo box. If you don't whatever thing you do with the first combo box is also done for the 2nd combo box... and you don't want that.
That's not entirely true. You can use the same listener for multiple controls. There are a few ways to determine which one triggered the event.
WARNING: untested code being shown.
In the latter example, it assumes you set the name of each control when constructing your combo boxes.
Apart from the fact that you'll need to make the combo boxes either final or instance references, I'll put on my Campbell cap:
Don't use == true or == false; simply use or