Search code examples
gwtgwtp

How to get the Central Widget of SplitLayoutPanel?


Lokk at this code;

SplitLayoutPanel splitLayoutPanel=new SplitLayoutPanel();
splitLayoutPanel.addWest(new Label("west"), 200);
splitLayoutPanel.add(new Label("center"));

then

Label myWestLb= (Label)splitLayoutPanel.getWidget(0); //this code is ok, no problem

Label myCentralLb= (Label)splitLayoutPanel.getWidget(1); //this code got error

Does anyone know how to get the Widget that was added into the center of SplitLayoutPanel?


Solution

  • There is a method for this. It is called getCenter() :).

    http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/DockLayoutPanel.html#getCenter%28%29