Using Buttons?
I'm trying to make a reset button to reset my game. It's not doing anything though...here's what I'm workin with. Basically, reset, makes the arraylist containg all of the pieces empty so there shudn't be any thing drawn to the board when i hit reset
import java.applet.*;
import java.awt.event.*;
import java.awt.*;
publicclass GameDisplayextends Appletimplements MouseListener, ActionListener
{
GamePlay game;
Image[] images;
String [] fonts;
Button reset;
Font font;
int font_size;
publicvoid init()
{
images = loadImages();
reset =new Button("Reset");
game =new GamePlay(images);
addMouseListener(this);
reset.addActionListener(this);
add(reset);
font_size = 50;
font =new Font("Sanserif", Font.BOLD, font_size);
}
publicvoid actionPerformed (ActionEvent ae)
{
if(ae.getSource()==reset)
{
game.reset(images);
repaint();
}
}
//more stuff
This code is in the GamePlay class:
publicvoid reset(Image[] i)
{
board =new Board(i[0]);
images = i;
turn = 1;
color ="red";
message ="";
gameOver =false;
}
And this is the board class:
public Board(Image i)
{
fileName ="C:\\Users\\JP\\Projects\\Connect Four\\src\\ConnectFourgrid.gif";
pic = i;
pieces =new ArrayList();
winner ="nobody";
over =false;
ct=1;
myLength = 7;
myWidth = 6;
}

