Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot find symbol

 
Megs Maquito
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Pls. help

heres the error:

PayCalc.java:34: cannot find symbol
symbol : constructor JComboBox(int[])
location: class javax.swing.JComboBox
dayOfMonth = new JComboBox(days);

 
Dan Patterson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JComboBox does not have a constructor that takes an array of ints.

Constructor Summary
JComboBox()
Creates a JComboBox with a default data model.

JComboBox(ComboBoxModel aModel)
Creates a JComboBox that takes it's items from an existing ComboBoxModel.

ComboBox(Object[] items)
Creates a JComboBox that contains the elements in the specified array.

JComboBox(Vector<?> items)
Creates a JComboBox that contains the elements in the specified Vector.

You could always change your ints to int objects.

Are you using J2SE 5.0?, if so I thought autoboxing and autounboxing would take care of this, maybe somebody can speak to this, im not sure about it.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dan Patterson:

Are you using J2SE 5.0?, if so I thought autoboxing and autounboxing would take care of this, maybe somebody can speak to this, im not sure about it.


That's a bridge too far for autoboxing. It can do the following:

but not this:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic