Search code examples
gwt

Can I define an ID for an HTMLPanel?


How can I define the ID for an HTMLPanel? Of course I could surround the HTML with a <div id="anID"> but this would also not set the ID of the panel.


Solution

  • You can do it like that :

    htmlPanel.getElement().setId( "yourId" );
    

    This works for any widget/element.