申し訳ありませんが、私はJavaの初心者ですが、変数petListをnullに設定せずに初期化するにはどうすればよいですか?
for (int x = 0;x<= buttonPressed;x++){
println("adding box");
String[] petStrings = { "Withdraw", "Deposit", "Blah", };
//Create the combo box, select item at index 4.
@SuppressWarnings({ "rawtypes", "unchecked" })
JComboBox petList[] = null;// = new JComboBox(petStrings);
petList[x] = new JComboBox(petStrings);
petList[x].setSelectedIndex(1);
petList[x].setBounds(119, (buttonPressed *20)+15, 261, 23);
contentPane.add(petList[x]);
}