Java でこのエラーが発生し続けるのはなぜですか? タイマーを使用する複数の方法を読みましたが、すべて予想されるエラーが発生しました。これをしばらく取得しようとしていました。
private class buttonRowColumn implements ActionListener
{
Button cell;
Timer timer = new Timer();
myTask t = new MyTask();
timer.schedule(t, 0, 500);
public buttonRowColumn(Button cell)
{
this.cell = cell;
}
public void actionPerformed(ActionEvent e)
{
System.out.println("row = "+cell.getRow()+", column="+cell.getColumn());
cell.button.setBackground(Color.red);
while(cell.checkClicked() == false || cell.getRow() < 5)
{
cell = buttons[0][cell.getColumn()];
if(cell != buttons[5][cell.getColumn()])
{
cell.button.setBackground(Color.red);
run();
}
timer.cancel();
cell.setClicked(true);
}
}
public class MyTask extends TimerTask
{
public void run()
{
cell.setBackground(null);
cell = buttons[cell.getRow() + 1][cell.getColumn()];
}
}
}