Electric-field domains in semiconductor superlattices: Resonant and nonresonant tunneling