当前位置:编程学习 > 网站相关 >>

Vaadin Web应用开发教程(35):UI布局-Accordion布局

Accordion布局类似TabSheet,不过是以垂直方式安排多个标签页,其使用方法也和TabSheet布局类似。

[java] 
// Create the Accordion.  
Accordion accordion = new Accordion(); 
  
// Have it take all space available in the layout.  
accordion.setSizeFull(); 
  
// Some components to put in the Accordion.  
Label l1 = new Label("There are no previously saved actions."); 
Label l2 = new Label("There are no saved notes."); 
Label l3 = new Label("There are currently no issues."); 
  
// Add the components as tabs in the Accordion.  
accordion.addTab(l1, "Saved actions", null); 
accordion.addTab(l2, "Notes", null); 
accordion.addTab(l3, "Issues", null); 
  
// A container for the Accordion.  
Panel panel = new Panel("Tasks"); 
panel.setWidth("300px"); 
panel.setHeight("300px"); 
panel.addComponent(accordion); 
  
// Trim its layout to allow the Accordion take all space.  
panel.getLayout().setSizeFull(); 
panel.getLayout().setMargin(false); 

// Create the Accordion.
Accordion accordion = new Accordion();
 
// Have it take all space available in the layout.
accordion.setSizeFull();
 
// Some components to put in the Accordion.
Label l1 = new Label("There are no previously saved actions.");
Label l2 = new Label("There are no saved notes.");
Label l3 = new Label("There are currently no issues.");
 
// Add the components as tabs in the Accordion.
accordion.addTab(l1, "Saved actions", null);
accordion.addTab(l2, "Notes", null);
accordion.addTab(l3, "Issues", null);
 
// A container for the Accordion.
Panel panel = new Panel("Tasks");
panel.setWidth("300px");
panel.setHeight("300px");
panel.addComponent(accordion);
 
// Trim its layout to allow the Accordion take all space.
panel.getLayout().setSizeFull();
panel.getLayout().setMargin(false);

 \

补充:Web开发 , 其他 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,