The rendering of the ComboBox’ textWhenNothingSelected can’t be changed using a LookAndFeel, and to make matters worse, it is inconsistent with the label rendering of LookAndFeel_V2 - while the LookAndFeel determines the textArea to draw the text in using label.getBorderSize(), ComboBox::paint reduces the label bounds by a hardcoded (2, 1) and draws the text inside that area.
This is my hacky modification of the ComboBox::paint method that renders the textWhenNothingSelected just like any other disabled label:
void ComboBox::paint (Graphics& g)
{
getLookAndFeel().drawComboBox (g, getWidth(), getHeight(), isButtonDown,
label->getRight(), 0, getWidth() - label->getRight(), getHeight(),
*this);
if (textWhenNothingSelected.isNotEmpty()
&& label->getText().isEmpty()
&& ! label->isBeingEdited())
{
label->setEnabled(false);
label->setText(textWhenNothingSelected, dontSendNotification);
label->paintEntireComponent(g, false);
label->setText("", dontSendNotification);
label->setEnabled(true);
}
}
