Problems with JComboBox

Can any one help me with java.lang.IllegalArgumentExeption(IWAV0177E Expression "patterns" is too compilcated. - new JComboBox(patterns))the code goesString[] patterns = { "S", "P", "1C", "Ps", "2C", "O", "W", "D", "K" };jComboBox = new JComboBox(patterns);
[285 byte] By [gigia] at [2007-10-2 22:32:48]
# 1

Not sure if this would thrown an exception like that but I noticed that you are declaring patterns as a String[] did you remember to declare that jComboBox was a JComboBox object?

like :

String[] patterns = { "S", "P", "1C", "Ps", "2C", "O", "W", "D", "K" };

JComboBox jComboBox = new JComboBox(patterns);

^

malachi_1616a at 2007-7-14 1:50:11 > top of Java-index,Security,Cryptography...
# 2

Yes i did declared that jComboBox as a JComboBox object. Don't know why but all kind of construktors like ...

1. JComboBox jComboBox = new JComboBox(patterns);

2. JList jList = new JList(listModel);

3. JScrollPane jScrollPane = new JScrollPane(jList);

... throw exeptions, i use jbeans maybe it referes to this matter :(

it throws exeption, but of course when running everything works properly

gigia at 2007-7-14 1:50:11 > top of Java-index,Security,Cryptography...
# 3

Hey,

I've had a similar problem today, and found a simple workaround...

String[] patterns = { "S", "P", "1C", "Ps", "2C", "O", "W", "D", "K" };

jComboBox = new JComboBox();

for(int i = 0; i < patterns.length; i++) {

jComboBox.addItem(patterns[i]);

}

Not perhaps the nicest way, but stopped the errors (although I was working in Eclipse). Hope that helps!

alistair_collinsa at 2007-7-14 1:50:11 > top of Java-index,Security,Cryptography...
# 4
Try to name it something different than jComboBox. Give it a name that explains what it does. Its not required, its just good practice.
CaptainMorgan08a at 2007-7-14 1:50:11 > top of Java-index,Security,Cryptography...