D: how is it local if the declaration is outside of it?
JPanel blackPanel[][] = new JPanel[8][7];
for( int x = 0; x < 7; x = x+1){
for( int y = 0; y < 6; y = y+1){
...
Type: Posts; User: 1LikePie
D: how is it local if the declaration is outside of it?
JPanel blackPanel[][] = new JPanel[8][7];
for( int x = 0; x < 7; x = x+1){
for( int y = 0; y < 6; y = y+1){
...
I'm still new at this so I just did what I kinda know.
The blackPanel array is for the default empty squares in my connect four game.
I will change the color when a player chooses to drop a "ball"
For some reason my version of java didn't recognized x++ as x+1 and put me in an infin. loop. That along with having my declaration in the loop and the lack of initialization. after fixing that stuff...
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
at ConnectFour.createContentPane(ConnectFour.java:31)
at ConnectFour.createAndShowGUI(ConnectFour.java:106)
at...
I am trying to make a Connect Four game with java swing, but I am getting an error with my attempt at making an multi D panel maker when I try to run it.
Any and all help would be awesome :D
...