Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Making part of Readonly text field Bold
Hi
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 <b>TreatmentAction Name</b> : 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 CustomField 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