- Google Web Toolkit 2 Application Development Cookbook
- Shamsuddin Ahammad
- 166字
- 2025-02-21 00:27:12
In this recipe, we are going to create a sidebar to be placed on the left-hand side of the homepage. This sidebar will be used for navigation.
- Define the method
getLeftSidebar:
public ContentPanel getLeftSideBar() { ContentPanel leftSidebarPanel = new ContentPanel(); leftSidebarPanel.setHeading("Left Sidebar"); return leftSidebarPanel; }
- Call the
add
method of classContentPanel
in the constructor to add the sidebar in the content panel:add(getLeftSideBar(), leftSidebarLayoutData);
The method getLeftSideBar
creates a content panel instance and sets a heading Left Sidebar. This heading will be modified later.
The left-hand sidebar created by this method is added in the west region of the main content panel by invoking add(getLeftSideBar(), leftSidebarLayoutData)
in the constructor.