refactor function showText(Integer index)