62,615
社区成员
发帖
与我相关
我的任务
分享
public class Line1 extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
public Line1(String[] array, String title) {
String[] station;
station = array;
JButton[] stationButton1 = new JButton[station.length];
Container container = getContentPane();
setLayout(new GridLayout(6, 5,10,10));
for (int i = 0; i < station.length; i++ ) {
stationButton1[i] = new JButton(station[i]);
container.add(stationButton1[i]);
}
setSize(800, 600);
setTitle(title);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
public class stationSelect implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
int index = new PrintArray(stationButton1, e).getIndex(); //这里stationButton1会报错
}
}
}