I have programmed a game that plays in a jframe. It should play 4 times the red paragraph. When the game is finished i have to push again on the menuitem "speel memory" and that is not the way I want it.

My question is how can 1 select once the menuitem "play memory" and execute 4 times "play memory"





package View.Menu;
import Model.*;

import View.Memory.MemoryKaartenPaneel;
import Model.MemoryInstellingen.Instellingen;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;

public class MenuVenster extends BasisMenuVenster implements ActionListener {
private Instellingen instellingen;
private MemoryKaartenPaneel newgame;

public MenuVenster() {
super("Memory spel");
instellingen = new Instellingen();
newgame = null;

JMenuBar menubar = new JMenuBar();
this.setJMenuBar(menubar);
JMenu menu1 = new JMenu("Ending");
JMenu menu2 = new JMenu("play game");

menubar.add(menu1);
menubar.add(menu2);

JMenuItem exitItem = new JMenuItem("End");
JMenuItem SpeelMemory = new JMenuItem("play memory");

menu1.add(exitItem);
menu2.add(playMemory);

SpeelMemory.addActionListener(this);

exitItem.addActionListener(this);
}

public void actionPerformed (ActionEvent evt){
String actionCommand = evt.getActionCommand();
cleanPanel();
if (actionCommand.equals("play Memory")){


newgame = new MemoryKaartenPaneel(instellingen);
this.getContentPane().add(newgame);
this.validate();


if (actionCommand.equals("End")){
System.exit(0);
}
}
private void cleanPanel(){
if (newgame != null){
remove (newgame);
}

}
}