• Post Reply Bookmark Topic Watch Topic
  • New Topic

Updating a comboBox  RSS feed

 
Matthew Tilic
Ranch Hand
Posts: 41
Chrome Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I am calling a function from a class to pass an array of information and to put the name in the comboBox.

I have used this same code in other programes and the comboBox will load. in this case the comboBox will not remove or add any itmes.

I can see the items in the degugger under the variables but it just wont appear!

I am using netbeans 6.9.1 and a JForm. Just incase that info is needed



 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's interesting that you ask for help with a JComboBox but then show us code that has nothing to with a JComboBox, as far as we can tell. Something missing?
 
Matthew Tilic
Ranch Hand
Posts: 41
Chrome Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
performanceDrop is a comboBox! oops
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think we're still not given enough information to give a total answer, but I'll give a partial one. It appears that the work is being done by the loop in the method


It's curious that you removeAllItems() from your JComboBox on every pass through the loop. Is that necessary?

P is an instantiation of class Performance, Per is an array of Performance objects. You set P to a specific element of the Per array, and then add P.Name to the JComboBox. You then print Per[i].Name (the same as P.Name). Is that just a debug check? Not sure of the reason for the use of P when you could simply use Per[i] as you do in the print statement, but that's not causing your problem.

I think the removeAllItems() is working against what you're trying to do in the rest of the loop, but please explain if I've gotten it wrong.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!