Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Assigning values in a two dimensional array into an array of ComboBoxes?

 
Declan Barrett
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am hoping that some of the gurus on here can point me in the right direction. I'm fairly new to java and what I'm trying to do is create three combo boxes and assign various value to them. I was hoping to achieve it using arrays and for loops but I've run into a problem. Is it actually possible to do? Here is my code so far:


The error so far is with the line
- No suitable constructor found for JComboBox(String)

I know I still have to create a frame and add the panel to it etc, but can anyone tell me where I'm going wrong and if creating an array of combo boxes, and assigning an array of strings to it, is possible in 'For loops'?

All help greatly appreciated,
Declan
 
Ashish Dutt
Ranch Hand
Posts: 172
Java MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to Java Ranch.
The problem definitely lies in that JComBox constructor because of the parameter that you are passing it.There had been a similar previous post; http://www.coderanch.com/t/618985/GUI/java/line-wrong-program-constructor-undefined, and this link Linkfrom Oracle docs might help you.
 
Declan Barrett
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ashish....it seems the problem was I wasn't comparing like with like on that line. It appears that I can just pass the complete row instead of specifying row and column and therefore only need one 'For' loop. Here is the amended working code:

 
Ashish Dutt
Ranch Hand
Posts: 172
Java MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome, Declan. We are happy that you were able to figure out the problem and resolve the issue.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!