Used DocumentListener instead of KeyListener