如何在Java中声明JComboBox数组

时间:2021-08-11 21:29:05

I need to use an array of ComboBox, I try to declare in different way, but I can't.

我需要使用一个ComboBox数组,我尝试以不同的方式声明,但我不能。

Can someone help me?

有人能帮我吗?

Last way is:

最后一种方式是:

final String[] comString = {"aa", "bb", "cc", "dd", "ee" };
private JComboBox<String> comList[]= new JComboBox[10];

1 个解决方案

#1


0  

With this declaration it works:

有了这个声明它起作用:

private JComboBox comList[]={null,null,null,null,null,null,null,null,null,null};

#1


0  

With this declaration it works:

有了这个声明它起作用:

private JComboBox comList[]={null,null,null,null,null,null,null,null,null,null};