I'm trying to get my pieces to fall down when the timer is instantiated. This is my code so far, I'm just not sure what I'm doing wrong.
package lab7;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import lab7.piece.Piece;
public class TimerHandler extends JPanel implements ActionListener {
private Piece _myPiece;
private javax.swing.Timer _t;
private final int _i = 1000;
public TimerHandler(){
_t = new javax.swing.Timer(_i, this);
}
public void start(){
_t.start();
}
public void addActionListener(){
}
@Override
public void actionPerformed(ActionEvent e) {
_t.start();
_myPiece.moveDown();
}
}
package lab7;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import lab7.piece.Piece;
public class TimerHandler extends JPanel implements ActionListener {
private Piece _myPiece;
private javax.swing.Timer _t;
private final int _i = 1000;
public TimerHandler(){
_t = new javax.swing.Timer(_i, this);
}
public void start(){
_t.start();
}
public void addActionListener(){
}
@Override
public void actionPerformed(ActionEvent e) {
_t.start();
_myPiece.moveDown();
}
}