Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding addPopupMenuListener to JCombo Box through Mouse Event  RSS feed

Tim Jones
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!