Are you serious?

If you are *creating the buttons dynamically* and you can declare the
clickHandler as a field it will be faster cause you will be avoiding the
handler instantiation every time...

but I don't think that choice will have a performance impact..

2010/7/13 cody <[email protected]>

> private final Button button;
> private final ClickHandler clickHandler;
>
> public MyClass(){
>
>
>              //Code 1
>               button.addClickHandler(new
> com.google.gwt.event.dom.client.ClickHandler() {
>                        public void
> onClick(com.google.gwt.event.dom.client.ClickEvent
> event) {
>                                Window.alert("msg");
>                        }
>                });
>
>                //Code 2
>                clickHandler=new
> com.google.gwt.event.dom.client.ClickHandler() {
>
>                        public void
> onClick(com.google.gwt.event.dom.client.ClickEvent
> event) {
>                                Window.alert("msg");
>                        }
>                };
>                button.addClickHandler(clickHandler);
> }
>
> Which code is better for performance ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>


-- 
http://gwtupdates.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to