• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Greenhorn
Posts: 28
  • 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
 
Ranch Hand
Posts: 172
Python MySQL Database Java
  • 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; https://coderanch.com/t/618985/GUI/java/line-wrong-program-constructor-undefined, and this link Linkfrom Oracle docs might help you.
 
Declan Barrett
Greenhorn
Posts: 28
  • 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
Python MySQL Database Java
  • 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.
 
    Bookmark Topic Watch Topic
  • New Topic