Time for action – using panels
Let's add a panel using our framework application.
- In
LayoutFrameworkUI
class, add agetPanel
method and call it from theinit
method to add the returned component to our main layout:public class LayoutFrameworkUI extends UI { protected void init(VaadinRequest request) { ... layout.addMenuOption("Panel", getPanel()); } ... private Panel getPanel() { String someNumbers = ""; for (int i = 0; i < 2000; i++) { someNumbers += " " + i; } Label content = new Label(someNumbers); Panel panel = new Panel("Panel's caption", content); panel.setWidth("200px"); panel.setHeight("100px"); panel.setScrollTop(3000); // pixels from top return panel; } }
- Run it!
What just happened?
Here is a screenshot of the application showing ...
Get Vaadin 7 UI Design By Example Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.