Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:41:46+00:00 2026-05-27T16:41:46+00:00

I need help with some gwt (ui:binder) code. I would like to add the

  • 0

I need help with some gwt (ui:binder) code.
I would like to add the content of the div element to the center of my DockLayoutPanel

The interesting part of my html file:

  ...     
  <body>
        <div id="Browser"></div>
  </body>  
  ...

My ui.xml:

    <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <ui:style>
        .westPanel {
            background-color: #00FFFF;
        }
        .northPanel {
            background-color: #FF0000;
        }
        .southPanel {
            background-color: #FFFF00;
        }
        .centerPanel {
            background-color: #FFFFFF;
        }
    </ui:style>
     <g:DockLayoutPanel unit='EM'>
       <g:north size='8'>
         <g:FlowPanel styleName="{style.northPanel}">
           <g:Label>NORTH panel</g:Label>
         </g:FlowPanel>
       </g:north>
       <g:west size='5'>
         <g:FlowPanel styleName="{style.westPanel}">
           <g:Label>Navigation panel</g:Label>
           <g:ListBox ui:field='listBox' visibleItemCount='5'/>
         </g:FlowPanel>
       </g:west>
       <g:center>
         <g:FlowPanel styleName="{style.centerPanel}">  

<!--             <g:HTMLPanel>  -->
<!--             <div id="Browser"> -->
<!--            </div> -->
<!--             </g:HTMLPanel> -->

         </g:FlowPanel>
       </g:center>
        <g:south size="5">
         <g:FlowPanel styleName="{style.southPanel}">
           <g:Label>SOUTH panel</g:Label>
         </g:FlowPanel>
        </g:south>
     </g:DockLayoutPanel>
</ui:UiBinder>

My owner class:

public class MyDockLayoutPanel extends Composite {

private static MyDockLayoutPanelUiBinder uiBinder = GWT
        .create(MyDockLayoutPanelUiBinder.class);

@UiField ListBox listBox;

interface MyDockLayoutPanelUiBinder extends
        UiBinder<Widget, MyDockLayoutPanel> {
}

public MyDockLayoutPanel() {
    initWidget(uiBinder.createAndBindUi(this));
}

public MyDockLayoutPanel(String... paths ) {
    initWidget(uiBinder.createAndBindUi(this));
    for (String path : paths) {
        listBox.addItem(path);
    }
}    
}

This didn’t work for me :

public class HelloUiBinder implements EntryPoint {

     public void onModuleLoad() {

         RootLayoutPanel.get().add(new MyDockLayoutPanel());
         MyDockLayoutPanel mydocklayoutpanel = new MyDockLayoutPanel("able","baker","charlie");

         MyDockLayoutPanel mydocklayoutpanelID = new MyDockLayoutPanel();

         RootPanel.get("Browser").add(mydocklayoutpanelID);

         RootLayoutPanel.get().add(mydocklayoutpanelID);
         RootLayoutPanel.get().add(mydocklayoutpanel); 
     }
}

How can I add the “Browser” to the center of my mydocklayoutpanel ?
Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:41:47+00:00Added an answer on May 27, 2026 at 4:41 pm

    Normally, Widgets are added to a div, not the opposite. So you can actually create a widget that wrap the “Browser” using HTMLPanel and then add it to MyDockLayoutPanel , here is an example:

    Browser.ui.xml

    <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
    <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <ui:style>
       <g:HTMLPanel>  
    
       </g:HTMLPanel> 
    

    Browser.java

    public class BrowserPanel extends Composite {
       private static BrowserPanelUiBinder uiBinder = 
       GWT.create(BrowserPanelUiBinder.class);
       interface BrowserPanelUiBinder extends   UiBinder<Widget, BrowserPanelPanel> {}
    
       public BrowserPanel() {
       initWidget(uiBinder.createAndBindUi(this));
       }
    }    
    

    The entryPoint

    public class HelloUiBinder implements EntryPoint {
     public void onModuleLoad() {
     MyDockLayoutPanel mydocklayoutpanel = new MyDockLayoutPanel    ("able","baker","charlie");
     mydocklayoutpanel.addWidget(new BrowserPanel());
     RootPanel.get().add(mydocklayoutpanel);
     }
    

    }

    In MyDockLayoutPanel.ui.xml change the FlowPanel

    <g:center>
     <g:FlowPanel styleName="{style.centerPanel}" ui:field="browser"> 
        </g:FlowPanel>
    </g:center>
    

    in MyDockLayoutPanel.java add :

    @UiField FlowPanel browser;    
        ...      
        public void addWidget(Widget widget){
        browser.add(widget);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help understanding some C++ operator overload statements. The class is declared like
I need help with some rewrite rule Pretty much all my pages look like
I need help with some code that i am writing for a small text
need some help! I'm trying to write some code in objective-c that requires part-of-speech
Need some help to write a C# code to send mail to multiple users
I need some help. I am creating a SelectItem class like this: public class
I need help from some one to convert the following line of code from
I am a pretty good applescripter, and would like some help with this. I
I need help some help printing out some xml. Here is my code (which
Need some help. I have a table with some columns..like name , phone etc...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.