Region positions are specified using compass points (e.g. north for top, west for left, east for right, south for bottom) and center. The center region is a privileged position that receives the remaining space not allocated to other regions. Border layout containers should generally specify a center region and one or more other regions.
Region layout parameters are specified using {@link BorderLayoutData} which controls the margin between the regions,the size of the region, the minimum and maximum size, whether the region has a split bar, whether the region is collapsible and other details.
Region size may be specified as a percent of the parent container size or a fixed number of pixels. The region size is specified as a single value that describes the orientation associated with the region (height for north and south, width for west and east).
The size, split bar and collapsible attributes are specified in the BorderLayoutData
for the region adjacent to the center region.
Code Snippet:
BorderLayoutContainer con = new BorderLayoutContainer(); ContentPanel cp = new ContentPanel(); cp.setHeadingText("North"); cp.add(new Label("North Content")); BorderLayoutData d = new BorderLayoutData(.20); d.setMargins(new Margins(5)); d.setCollapsible(true); d.setSplit(true); con.setNorthWidget(cp, d); cp = new ContentPanel(); cp.setHeadingText("West"); cp.add(new Label("West Content")); d = new BorderLayoutData(.20); d.setMargins(new Margins(0, 5, 5, 5)); d.setCollapsible(true); d.setSplit(true); d.setCollapseMini(true); con.setWestWidget(cp, d); cp = new ContentPanel(); cp.setHeadingText("Center"); cp.add(new Label("Center Content")); d = new BorderLayoutData(); d.setMargins(new Margins(0, 5, 5, 0)); con.setCenterWidget(cp, d); Viewport v = new Viewport(); v.add(con); RootPanel.get().add(v);
|
|
|
|
|
|