Memory tag bindings

ClassCastException: Cannot coerce value ‘2’ into type: interface java.awt.Paint
I am trying to tint a symbol using a memory tag as every data type and keep getting this error when I try to change the valuation of tint.

youtube.com/watch?v=Ku0-Jctn … ure=relmfu
I watched this video and followed it exactly except instead of using a PLC tag, I’m using a memory tag.
Any suggestions?

It means you are trying to bind the paint property to a number. What binding are you using for the fill paint? Expression or tag? Can you post a screenshot?


its a memory tag binded to a color change property. I had used it as an integer… 0 1 2

This one is a bit more clear…
I’m using an int8 memory tag referenced to a color property.

The way I understand colors in Ignition is that they’re a complex data type. You can represent them in a few ways; the simplest is by a string name like ‘red’ or ‘blue’, and the most common is as a ‘tuple’.

color(75,255,71) is a nice light green, for example.

Are you looking for a continuously variable tint number, or just to color something red or green ?

The easiest way to change the color of a geometric object is to bind the StrokePaint or the FillPaint to an ordinary Tag, and use the color/value table.

Also: remember that an INT[8] is an 8-byte datatype. While memory is plentiful, you probably don’t need a 64-bit value to express a color.

EDIT: I watched the video you linked to and it shows the color/value table that is available when you bind a Color to a Tag or Expression. I followed the same steps, using an INT[8] DB tag, and didn’t get the same error message as you did.

You need to create a dynamic property on the screen object and bind your memory tag to that. Then create a Style customizer that consumes the property and toggles the Stroke Color or Foreground Color property.

OK I learned that this error was because I did not have the latest version of Java installed.

Thanks for the update ! I was scratching my head about what we might have done differently.

Can you post what version of Java you had previously (that included that error) and which one you’ve updated to ?

I’m running Java 1.6.0_31 on Windows 7 Professional x64.

Handy tip: you can look up your Java version here: http://javatester.org/version.html

I’m not sure what version it was before, but im running windows 32x and it updated it for me so I must have not had the up to date version.