
上QQ阅读APP看书,第一时间看更新
In this recipe, we are going to create a sidebar to be placed on the right-hand side. This sidebar will be used for some dynamic contents based on the main contents at the center.
- Define the method
getRightSidebar:
public ContentPanel getRightSideBar() { ContentPanel rightSidebarPanel = new ContentPanel(); rightSidebarPanel.setHeading("Right" Sidebar"); return rightSidebarPanel; }
- Call the add method of class
ContentPanel
in the constructor to add the sidebar in the content panel:add(getRightSideBar(), rightSidebarLayoutData);
The method getRightSideBar
creates a content panel instance, and sets a heading Right Sidebar. This heading will be modified later.
The right-hand sidebar created by this method is added in the east region of the main content panel by invoking add(getRightSideBar(), rightSidebarLayoutData)
in the constructor.