By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

Adding ComboBox Items with a loop

P: n/a
Hi, im a just wondering how to add elements into a JComboBox through a
loop ie. just say i wanted to add the numbers 1 throught to 100. It
seems easy but im having a bit of trouble. One problem which i have
had is that i end up only adding the last number (100) to the
ComboBox. Any help appreciated :)
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
This is probably caused by not newing an object each time you set it to the
new number. By not new(ing) the object you are just adding the same object
100 times.

"- ions" <ne*************@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
Hi, im a just wondering how to add elements into a JComboBox through a
loop ie. just say i wanted to add the numbers 1 throught to 100. It
seems easy but im having a bit of trouble. One problem which i have
had is that i end up only adding the last number (100) to the
ComboBox. Any help appreciated :)

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.