Search code examples
javahtmlcssgwtgxt

Unable to change the font family in GXT text Area


I am not able to change the default font family of GXT Text Area. I have tried using StyleInjector and CSS. But it is not getting updated. Can you please help me?

TextArea textArea = new TextArea();
textArea.setStyleName("gxtTextArea");

And in the CSS file, I have given as,

.gxtTextArea {
    font-family: Arial !important; 
    /* color: red !important;
    font-size: 24px !important;
    font-style: bold !important;        
    font-weight: bold !important; */
} 

Solution

  • You can also use addStyleName instead of setStyleName.

    TextArea textArea = new TextArea();
    textArea.addStyleName("gxtTextArea");
    

    And in the CSS side, change it as below.

    .gxtTextArea * {
        font-family: Arial !important; 
        /* color: red !important;
        font-size: 24px !important;
        font-style: bold !important;        
        font-weight: bold !important; */
     }