Closed wyj3531 closed 2 years ago
You can use WebComboBoxRenderer which has separate methods you can override for various text settings. For instance specifically for text style, size and color:
combobox.setRenderer ( new WebComboBoxRenderer ()
{
@Override
protected Font fontForValue ( final ListCellParameters parameters )
{
return super.fontForValue ( parameters );
}
@Override
protected Color foregroundForValue ( final ListCellParameters parameters )
{
return super.foregroundForValue ( parameters );
}
} );
You can specify generics for WebComboBoxRenderer
if you know particular types of your combobox values, that will provide you the specific rendered value with correct type via ListCellParameters
.
If you aren't using custom WebLaF renderer - you can check the Swing tutorial on combobox that explains how it can be done: https://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html
i just want to this three place in different style,like textSize,textColor, .in getListCellRendererComponent method can not do it. how to do it.