You need to overrid the actionPerformed()
with the same signature as defined by ActionListener
when implementing ActionListener
You have
public void actionPerformed(ActionEvent e, int answer)
Which is an incorrect signature. Should just be this
public void actionPerformed(ActionEvent e)
You should declare the int answer
as a class member of timesTableFrame
so it can be used inside the actionPerformed
. Or access answer
through an instantiation of generateArray
.
Side note: There are many hints in our comment convo from your post. Take a look at them for option.
Edit: options
Making answer
class member
class timesTableFrame ... {
int answer; // now answer is a class member of timesTableeFrame
public void actionPerformed(ActionEvent e){
// answer can be accessed from inside this method
}
class generateArray{
// answer can be accessed from inside the inner class
}
}
Using answer
without making it a class member
class timesTableFrame ... {
generateArray generatedArray = new generatedArray();
public void actionPerformed(ActionEvent e){
int answer = generatedArray.getAnswer();
}
class generateArray{
private int answer;
public int getAnswer(){
return answer;
}
}
}