@Override public void actionPerformed(ActionEvent e) { if (playPauseStop.getStatus() == Status.DONE) { playPauseStop = ppsFactory.newPlayPauseStop(); } if (playPauseStop.getStatus() == Status.NEW) { playPauseStop.startPlaying(); } else { if (playPauseStop.getStatus() == Status.PAUSED) { playPauseStop.continuePlaying(); } } }
/** * New listener with a fixed factory to obtain {@link PlayPauseStop} * * @param ppsFactory factory to obtain the {@link PlayPauseStop} to work with */ public PlayActionListener(PlayPauseStopFactory ppsFactory) { this.ppsFactory = ppsFactory; playPauseStop = ppsFactory.newPlayPauseStop(); }