这是我的代码...
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class test extends JFrame {
public test() {
setSize(1000,600);
}
private static JButton[] remove;
private static JPanel p = new JPanel();
public static void main(String[]args){
JFrame t = new test();
remove = new JButton[25];
for (int i = 0; i < 25; i++) {
remove[i].setBounds(243, 92 + 30 * i, 85, 20);
}
t.setVisible(true);
}
}
我创建了一个包含 25 个按钮的数组,但为什么它仍然抛出这个错误:S?