Display red star sign in a column

Dear All:

How could I display a red star sign with a value in a column cell of a table?
Please refer the attachment.

Thanks a lot.


You need to use a column whose type is a Label instead of plain String. Then you can add a Label component in XHTML mode to the column and style the red asterisk using CSS.

Instead of

table.addContainerProperty("column name", String.class, null);


table.addContainerProperty("column name", Label.class, null);

And for the Label:

new Label("<span class=\"red\">*</span>Project No", Label.CONTENT_XHTML);
.red {
  color: red;