Adding addPopupMenuListener to JCombo Box through Mouse Event
Joined: Apr 06, 2008
UPDATE: Perhaps there is more elegant/better way to do this?
When comboBox (line 34) is clicked the MouseListener (line 38) calls method "userNames()" (line 51), which sets up a connection to the database and returns an ArrayList. PopupMenuListener "srcListener" (line 8) calls the method "userNames()" and adds it to the comboBox (line 34). Problem: When Mouse Listener activates, combo box population occurs multiple time (should be only once). Another problem is that everytime mouse listener is triggered it appends the ArrayList to the combo box, should delete the existing list before adding the new combo box.