@Override
    public void update(Observable o, Object arg) {
        switch ((String) (arg)) {
            case "start":
                startGame();
                break;
            case "your turn":
                JOptionPane.showMessageDialog(this, "It's your turn, you can play", "Info", JOptionPane.INFORMATION_MESSAGE);
                drawBoat();
                turnLabel.setBackground(Color.GREEN);
                turnLabel.setText("it is your turn");
                move.setEnabled(true);
                turn.setEnabled(true);
                shoot.setEnabled(true);
                refresh.setName("Validate");
                refresh.setText("Validate");
                break;
            case "opponent turn":
                JOptionPane.showMessageDialog(this, "Your opponent hasn't played yet.\n Please wait your turn.", "Info", JOptionPane.INFORMATION_MESSAGE);
                turnLabel.setBackground(Color.RED);
                turnLabel.setText("it is not your turn");
                move.setEnabled(false);
                turn.setEnabled(false);
                shoot.setEnabled(false);
                refresh.setName("Refresh");
                refresh.setText("Refresh");
                break;
            case "refreshWindow":
                drawBoat();
                break;
            case "validate":
                JOptionPane.showMessageDialog(this, "Your opponent hasn't played yet.\n Please wait your turn.", "Info", JOptionPane.INFORMATION_MESSAGE);
                turnLabel.setBackground(Color.RED);
                turnLabel.setText("it is not your turn");
                move.setEnabled(false);
                turn.setEnabled(false);
                shoot.setEnabled(false);
                refresh.setName("Refresh");
                refresh.setText("Refresh");
            case "SQLException":
                JOptionPane.showMessageDialog(this, "SQL Exception occurs. Sorry", "Error", JOptionPane.ERROR_MESSAGE);
                break;
            case "invalid move":
                JOptionPane.showMessageDialog(this, "You can't do this move because your boat will be out of the map", "Error", JOptionPane.ERROR_MESSAGE);
                break;
            case "invalid boat selection":
                JOptionPane.showMessageDialog(this, "Your selection is not a boat.\n Please retry.", "Error", JOptionPane.ERROR_MESSAGE);
                break;
            case "no more moves":
                JOptionPane.showMessageDialog(this, "The selected boat hasn't got any moves.\n Please select another one or validate your moves.", "Error", JOptionPane.ERROR_MESSAGE);
                break;

        }
    }