In this older API the image is created within FontImage and so the colors are coded there. If you change the UIID you need to invoke setMaterialIcon again. If you use the newer API of Label.setMaterialIcon() it should work seamlessly.
On Monday, October 26, 2020 at 5:18:09 AM UTC+2 [email protected] wrote: > HI, > > I created a little method that should change the color of the image, but > can't make it happen. > In the Label component I load the image like this: > * Label lbImagenInventario = new Label ();* > * FontImage.setMaterialIcon (lbImagenInventario, > FontImage.MATERIAL_LOCAL_SHIPPING);* > > And the method is as follows: > * private void changesInventColor (Double quantity, Label lbIcon, Label > lbCantidad) {* > * if (quantity <0) {* > * lbIcono.setIconUIID ("LabelRojo");* > * lbCantidad.setText (round (amount, 2));* > * lbCantidad.setUIID ("LabelRojo");* > * } else if (amount> 0) {* > * lbIcono.setIconUIID ("LabelVerde");* > * lbCantidad.setText (round (amount, 2));* > * lbCantidad.setUIID ("LabelVerde");* > * } else {* > * lbIcono.setIconUIID ("LabelGris");* > * lbCantidad.setText (round (amount, 2));* > * lbCantidad.setUIID ("LabelGris");* > * }* > * }* > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/6503e966-fe72-43ec-aa9c-de6fe502861cn%40googlegroups.com.
