I am currently in the process of making a slots game.
I have a history feature implemented as such. In my class I have the following static variable
static String[][] figureHistoryArray = new String [1000][4];
Everytime a user presses a "spin" button in the GUI a method called slotSpin() is activated.
Within this method I have got
figureHistoryArray[turnCounter][0]= rollOne.getFigureName();
figureHistoryArray[turnCounter][1]= rollTwo.getFigureName();
figureHistoryArray[turnCounter][2]= rollThree.getFigureName();
In which each slot spin gets saved.
After that I display the data in the GUI
private JTable historyTable;
And in the method:
historyPanel = new JPanel();
historyPanel.setLayout( new BorderLayout() );
getContentPane().add(historyPanel );
// Create columns names
String columnNames[] = { "Slot 1", "Slot 2", "Slot 3", "Win/Loss" };
String[][] dataValues= TheBigA.figureHistoryArray;
// Create a new historyTable instance
historyTable = new JTable( dataValues, columnNames );
// Add the historyTable to a scrolling pane
this.scrollPanel = new JScrollPane( historyTable );
historyPanel.add(this.scrollPanel, BorderLayout.CENTER );
add(historyPanel);
Now my issue is whenever the user presses "New Game" the history from the previous game is still being displayed. How would I go about fixing this