private void menuDeleteBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDeleteBoxActionPerformed
        PokemonBox box = (PokemonBox)listBoxes.getSelectedValue();
        int option = JOptionPane.showConfirmDialog(this, "Are you sure you want " +
                " to delete " + box.getName() + "?", "", JOptionPane.YES_NO_OPTION);
        if (option != JOptionPane.YES_OPTION)
            return;

        while (box.getSize() != 0) {
            box.removePokemonAt(box.getSize()-1);
        }

        //If the user has rigged it with duplicates, files may remain
        boolean badlyFormatted = true;
        File boxFile = box.getBoxFolder();
        for (File file : boxFile.listFiles()) {
            if (file.isDirectory() && file.listFiles().length > 0) {
                badlyFormatted = true;
            } else {
                file.delete();
            }
        }

        if (boxFile.delete()) {
            m_boxModel.removeBox(box);
        } else if (!badlyFormatted) {
            JOptionPane.showMessageDialog(this, "Error deleting box", "Error",
                JOptionPane.ERROR_MESSAGE);
        } else {
            JOptionPane.showMessageDialog(this,
                    "The box is badly formatted, so it couldn't be removed", "Error",
                    JOptionPane.ERROR_MESSAGE);
        }

        m_boxModel.fireListChanged();
        m_pokemonModel.fireTableDataChanged();
        
        listBoxes.clearSelection();
    }//GEN-LAST:event_menuDeleteBoxActionPerformed