Im using a progress Panel for a typing tutor. When the typing lesson ends I cannot do anything else with the Progress Panel e.g. resetting a lesson. Other less important buttons work e.g. changing the colour and font sizes etc.

The buttons are created by an action Listener. It all works perfect untill the lesson ends, and the progress panel freezes.

What is the correct way to call an action Listener method so that it will work when the lesson is completed?

Here is some of the code im using.

boolean isCorrectKey = progressPanel.type( charTyped );
if( progressPanel.atEnd() ) {
currentLessonLine++;
switch (lessonNumber) {
case 1:

if (currentLessonLine < lesson1.length) {
progressPanel.setText(lesson1[currentLessonLine]);
currentLessonLine++;
break;
}
case 2:

if (currentLessonLine < lesson2.length) {
progressPanel.setText(lesson2[currentLessonLine]);
currentLessonLine++;
break;
}

default: // end of lesson

javax.swing.JOptionPane.showMessageDialog(null, progressPanel.message());
javax.swing.JOptionPane.showMessageDialog(null, progressPanel.getResults());


/*
* Close off lesson - more typing will cause exceptions - exceeding array bounds
*/
//}
}
}

public void lessonbutton_ActionPerformed(ActionEvent event) {

if(lessons.getSelectedItem() == "Lesson 1"){
progressPanel.setText( lesson1[currentLessonLine] );
mainheading.setText("Lesson 1: The home keys");
lessonNumber =1;

}

else if(lessons.getSelectedItem() == "Lesson 2") {
progressPanel.setText( lesson2[currentLessonLine] );
mainheading.setText("Lesson 2: 'g' and 'h' keys");
lessonNumber =2;
}