I must write a connect4 gui. I started off by creating a 2D array of JButtons. It well recieved by the java compiler though.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class AppPanel extends JPanel {
private JButton[][] slots = new JButton[6][7];
public AppPanel() {
for(int i=0; i<6; i++) {
for(int x=0; x<7; x++) {
add(slots[i][x]);
}
}
}
}
I really cannot figure what is wrong with it. Can anyone offer a suggestion?