public void nextStep() { game.nextStep(); mainPanel.remove(boardPanel); boardPanel.removeAll(); boardPanel.add(new JLabel(game.outputText()), BorderLayout.NORTH); boardPanel.add(new JLabel(game.outputBoard()), BorderLayout.CENTER); mainPanel.add(boardPanel); repaint(); printAll(getGraphics()); }