Hello,
I would like my Label and it’s text editor to have as a background the rounded corner rectangle. It seems that the best idea would be to create my own look and feel for Label and it’s text editor.
But I have a problem that I created my own look and feel for Label and I override: void drawLabel(Graphics &g, Label& l)
And I left it empty.
But my label still has white background.
I also override that: TextEditor* Label::createEditorComponent()
And inside of it I set the editor look and feel, and in my look and feel I override: void fillTextEditorBackground(Graphics &g, int width, int height, TextEditor &t) void drawTextEditorOutline(Graphics &g, int width, int height, TextEditor &t)
And I make those methods empty, but I stiil have a text when I edit Label and that’s OK, but I would like to have a control how that text is drawn. But I have no idea how to do that.
For any help great thanks in advance.
Best regards
You should write your rounded corner rectangle code for your custom Label on that particular overridden LookAndFeel drawLabel. If you left it empty, and assign the LookAndFeel to your custom Label there’s nothing to draw.
That’s right there is nothing to draw, but it still fill all Label background with white colour. But actually I fix that. The problem was I made my Label opaque. So I set opaque to false, and now everything is fine. But I still don’t know how to draw customised text for my label text editor.
You can’t really draw the TextEditor text from the LookAndFeel as you can with a Label. It’s quite more involved and done by the class itself. You can still change the font, colors, justification, margins etc. I guess you’ve already seen this, but just in case, this is what LookAndFeel can do for a TextEditor.