简体   繁体   中英

GWT TextArea Event Listener

I am going to try to add a listener but i don't know what to do.

I want to execute a function after the user finish inputting text.

For example, a user input text "123" in to my TextArea and use mouse to click outside , or click another field / whatever.

What listen should i use in GWT?

I don't know the keywords of the listener so i come here for help.

The Code i had try it simply, actually i don't think it helps a lot if i provide the coding since i only don't know what listener / how to make the function i want.

private TextArea TextAreaPartA;
TextAreaPartA = new TextArea();
TextAreaPartA.setFieldLabel("PartA");
TextAreaPartA.setSize(500, 40);
//TextAreaPartA.onComponentEvent(ce);

You can try addBlurHandler

TextAreaPartA.addBlurHandler(new BlurHandler()
{
            @Override
            public void onBlur(BlurEvent event)
            {
                         //do stuff
            }
});

Use AddBlurHandler,

TextArea area=new TextArea;    
 area.addBlurHandler(new BlurHandler() {
            @Override
            public void onBlur(final BlurEvent event) {
                // Do the Stuff here
            }
        });

addBlurHandler() does not work because it seems like you are not using the actual GWT TextArea (I think you use the TextArea from GwtExt). Please check your import, it should be import com.google.gwt.user.client.ui.TextArea;

Please also note that you should start variable names lowercase.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM