The method you found: write is display text string in a textarea.
However, in the drawingPanel, what you want to do is DRAW a STRING on the drawing Panel.
To draw, you can draw at any position. For textarea, it was first divided as line, and text can only displayed on those line. So next line make sense. However, there is no next line in the drawing Panel.
That is the reason why it was not working for your case.