Search code examples
javahtmlcssgwtgxt

setProperty for color attribute is not working in gxt text area


I have to change the font color of text area dynamically from the color menu. But I am not able to change it. Can you please help me ?

final ColorMenu fontColorMenu = new ColorMenu();
fontColorMenu.getPalette().addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) { 

       //textarea.getElement().getStyle().setColor("#"+event.getValue()); // Not working
       //textarea.getElement().getStyle().setProperty("color", "#"+event.getValue()); // Not working
         textarea.getElement().getStyle().setProperty("Color", "red !important");   // Not working
         }
       });

Solution

  • You can try this:

    textarea.getCell().getInputElement(textarea.getElement()).getStyle().setColor("red");
    

    Do not know if this is the best solution, but it works or me.