public void enemyAttacks() {

        // will choose a random square to attack in UserPanel
        if (canAttack) {
            enemyTarget = rand.nextInt(25);                     // get a target
            while (!battleSquare[enemyTarget].isEnabled()) {
                // check to see if the JButton is enabled
                // if JButton is not enabled, get a new target
                enemyTarget = rand.nextInt(25);
            }
            battleSquare[enemyTarget].setEnabled(false);
            canAttack = false;

            if (battleSquare[enemyTarget].getText().equals("SHIP")) {
                enemyHits++;
                battleSquare[enemyTarget].setText("");
                battleSquare[enemyTarget].setIcon(boomIcon);
            }
            if (enemyHits == MAX_SCORE) {
                JOptionPane.showMessageDialog(null, "You Lost!");
                System.exit(0);
            }
        }

    }