Why does TextEditor defaults to being setOpaque?

after some long struggling with trying to understand why my LookAndFeel subclass failed to properly paint a TextEditor, I tracked it down to the fact the TextEditor defaults to being setOpaque (true) in its constructor.

I understand that this is safe as long as the LookAndFeel methods for drawing the TextEditor fill its bounds rectangle completely, but isn’t it too strong as an assumption, especially now that TextEditors with rounded corners are so common?

Also, isn’t it strange that the TextEditor is the only widget being setOpaque (true) in its constructor? am I missing sometihng here?

Hmm, can’t remember exactly why it’s done that way… A better approach would be what some other components do, which is to base their opacity on the background colour that’s been set. Will try to find time to do that at some point, thanks.

Well, that’s not strictly correct either: even if a component has a solid (non-transparent) background colour, it could still be not rectangular and thus needing some of what’s behind it to be painted… that’s the case for a rounded corner TextEditor or TextButton, for example