How to set back ground color to a textfield

354 views
Skip to first unread message

Katta Vijay

unread,
Jan 31, 2012, 7:26:31 AM1/31/12
to Google Web Toolkit
Here I'm trying to create a textfield as disabled with background
color as a red/green!
i can able to make it as a disabled but color doesn't rendering in
browser...
i'm using

textfield.setStyleAttribute("backgroundColor","green"); method but
it's not rendering into browser !

any idea about this kind of issue .

Thanks in advance

Vijay Katta

Qrunk

unread,
Jan 31, 2012, 12:10:57 PM1/31/12
to google-we...@googlegroups.com
I tried the same on a button(add button), its working for me,

try out this :

@UiHandler("add")
    void onAddClick(ClickEvent event) {
        //addRows();
        add.setEnabled(false);
        if(!add.isEnabled()){
            System.out.println("Hello");
            add.getElement().getStyle().setBorderColor("red");
        }
       
    }

Here add is button added using UiBinder, onClick I make it disabled and change the border color to red

Amith K Bharathan

unread,
Jan 31, 2012, 9:40:13 PM1/31/12
to google-we...@googlegroups.com
Define a style in your gxtAll.css for ex in css


XYZ
{
 backgrnd : green;
}

textfield..setStyleName("XYZ");


try this it will work



Katta Vijay

unread,
Feb 1, 2012, 12:52:52 AM2/1/12
to Google Web Toolkit
I tried like you suggested but it did't work for a textfield !

On Jan 31, 10:10 pm, Qrunk <kapil2ka...@gmail.com> wrote:
> I tried the same on a button(*add *button), its working for me,

Amith K Bharathan

unread,
Feb 1, 2012, 2:42:21 AM2/1/12
to google-we...@googlegroups.com
please try with background image 
Reply all
Reply to author
Forward
0 new messages