Localization, resonance and non-Hermitian quantum mechanics