cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Setting text color in dataUtility

AntonBagryanov
3-Visitor

Setting text color in dataUtility

Hi to all!

How can I set the text color inside the dataUtility?

localDispText = new TextDisplayComponent((String)localName);

((TextDisplayComponent)localDispText).setValue((String)localName);

Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions

Create your own LabelRenderer inside your dataUtility class like following:

class TextRenderer extends LabelRenderer

{

protected void renderObject(Object obj, PrintWriter printwriter, RenderingContext renderingcontext) throws RenderingException

{

Label label = (Label)obj;

String color= "#ff0000";

write(printwriter,"<b style=\"color:" + color + "\">"+label.getValue()+"</b>");

}

}

View solution in original post

3 REPLIES 3

Create your own LabelRenderer inside your dataUtility class like following:

class TextRenderer extends LabelRenderer

{

protected void renderObject(Object obj, PrintWriter printwriter, RenderingContext renderingcontext) throws RenderingException

{

Label label = (Label)obj;

String color= "#ff0000";

write(printwriter,"<b style=\"color:" + color + "\">"+label.getValue()+"</b>");

}

}

Hi Anthony, 

 

Can you please give a complete dataUtility example ? 

 

Thank you in advance, 

 

Hicham

Hi @HL_10554529 

Check a customization guide Link to guide 12.1.2.0.

 

HelesicPetr_0-1679058130670.png

PetrH

 

Top Tags