You would start with:

public class CustomWidget extends Widget {

  public CustomWidget() {
    super();
    setElement(Document.get().createDivElement());
  }

}

This will give you a simple Widget represented by a <div> element. In 
general just take a look at the GWT source code to see how to write a 
Widget from scratch.

-- J.



Am Sonntag, 4. März 2012 22:20:01 UTC+1 schrieb Jan:
>
> Hi, 
>
> i like to create a Custom widget with javascript, but did not find a 
> tutorial for this. I tried to create a simple "div" Elment for the 
> start. But this does not work. Throws some errors. Can someone tell me 
> some good tutorial on this or give me some tips to correct my code? 
>
>
>
> package test.client; 
>
> import com.google.gwt.user.client.ui.Widget; 
>
> public class CustomWidget extends Widget{ 
>
>
>         public CustomWidget(){ 
>                 super(); 
>                 createElement("sdf"); 
>
>         } 
>
>         public static native void createElement(String msg) /*-{ 
>
>                 var newdiv = $doc.createElement('div'); 
>                 newdiv.setAttribute('id','testid'); 
>
>                   newdiv.innerHTML = 'Test Element'; 
>                   $doc.appendChild(newdiv); 
>         }-*/; 
>
> } 
>
>
> Thanks very much 
> jan

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ntCKT80kBkYJ.
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