Refactor addTextPanel