Making part of Readonly text field Bold


I have a form where i need to display a filed as readonly text field. The Issue Now is requirement is such that i need Part of the text that goes into this read only filed to be Bolded.
I can do this using label but when i try this i get exception saying that label cannot be cast to filed.

java.lang.ClassCastException: com.vaadin.ui.Label cannot be cast to com.vaadin.ui.Field.

I use custom filed factory to generate this Read only filed.

Actually I have a TreatmentAction object I need to display like TreatmentAction Name : TreatmentActionDescription

How can this be achieved. I am not good at CSS. Please help me

Well I don’t know a way how you would make the text of a HTML-textfield partly bold. Therefore I don’t think there is a way to do it using the Vaadin-Textfield. Your approach using a Label seems to be the right direction, but you would have to implement the interface Field in an own subclass of Label. As it is readonly that should be easy enough.

You could also use the
add-on to make a Field that is presented as a label, and return that field in your field factory.

Thanks All I have finally used the CustomField addon for resolving this