ImageIcon img_1 = new ImageIcon("src/menu/btn_1.jpg");
ImageIcon img_2 = new ImageIcon("src/menu/btn_2.jpg");
ImageIcon img_3 = new ImageIcon("src/menu/btn_3.jpg");
ImageIcon img_4 = new ImageIcon("src/menu/btn_4.jpg");
ImageIcon img_5 = new ImageIcon("src/menu/btn_5.jpg");
ImageIcon img_6 = new ImageIcon("src/menu/btn_6.jpg");
ImageIcon img_7 = new ImageIcon("src/menu/btn_7.jpg");
ImageIcon img_8 = new ImageIcon("src/menu/btn_8.jpg");
ImageIcon img_9 = new ImageIcon("src/menu/btn_9.jpg");
bgNumbers = new ButtonGroup();
btnNumbers = new JToggleButton[9];
for (int i = 0; i < 9; i++) {
btnNumbers[i] = new JToggleButton(???);
.....
.....
}
如何将个体ImageIcon img_1,img_2 ....... img_9插入循环?
答案 0 :(得分:0)
将它们添加到数组而不是单个变量。 - GáborBakos4月4日7:35