Set event to JList

I have developed java application in netbeans IDE. I am using JList for my application. And I have 5 combobox on same frame. When I select number of combobox, values of that are added in JList. And when I deselect same combobox which I selected previous, values of that are get remove from JList.
I want to set event to JList so that I get count of items of JList each time when I add and removed item. I want to fire event without touching it or without grabbing focus. I also want to do some operations on same event.
So which event I should use? Please help
AuriiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

for_yanCommented:

You can use ItemListnere event
and define itemStateChanged(ItemEvent e) method
for_yanCommented:
You add ItemListener to each of your comboboxes and then
you check when item state changes and on which combo box

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
You should already have the ability to do this: if you are changing the JList depending on the selection/deselection of an item in the combo box then you must be using some sort of listener, in which you're determining how many items the JList is going to hold. I don't see the need for an extra event.

If you're determined to have one for some reason then you can create a custom event:

http://www.exampledepot.com/egs/java.util/CustEvent.html

or look at

http://download.oracle.com/javase/6/docs/api/javax/swing/JList.AccessibleJList.html#contentsChanged(javax.swing.event.ListDataEvent)

which is already a JList that responds to changes in its data
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.