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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Setting text color in dataUtility

AntonBagryanov
12-Amethyst

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!

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

 

Announcements


Top Tags