View Single Post
  #1 (permalink)  
Old 02-14-2008, 08:27 AM
stevemcc stevemcc is offline
Member
 
Join Date: Feb 2008
Posts: 7
stevemcc is on a distinguished road
2D Array of JButtons
I must write a connect4 gui. I started off by creating a 2D array of JButtons. It well recieved by the java compiler though.
Code:
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?
Reply With Quote
Sponsored Links