當前位置: 首頁>>代碼示例>>Java>>正文


Java VerticalLayout.addComponents方法代碼示例

本文整理匯總了Java中com.vaadin.ui.VerticalLayout.addComponents方法的典型用法代碼示例。如果您正苦於以下問題:Java VerticalLayout.addComponents方法的具體用法?Java VerticalLayout.addComponents怎麽用?Java VerticalLayout.addComponents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.VerticalLayout的用法示例。


在下文中一共展示了VerticalLayout.addComponents方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest vaadinRequest) {
	final VerticalLayout layout = new VerticalLayout();

	final TextField name = new TextField();
	name.setCaption("Type your name here:");

	Button button = new Button("Click Me");
	button.addClickListener(e -> {
		layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!"));
	});

	layout.addComponents(name, button);

	setContent(layout);
}
 
開發者ID:peterl1084,項目名稱:vaadin-karaf,代碼行數:17,代碼來源:MyUI.java

示例2: init

import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request)
{
    setLocale(Locale.US);

    final HorizontalLayout rootLayout = new HorizontalLayout();
    rootLayout.setSpacing(false);
    rootLayout.setSizeFull();

    final VerticalLayout navigationLayout = new VerticalLayout();
    navigationLayout.setWidth(null);
    final Label title = new Label("HTML5 History API<br>Navigation", ContentMode.HTML);
    title.setStyleName(ValoTheme.LABEL_H1);
    title.addStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER);
    navigationLayout.addComponent(title);
    rootLayout.addComponent(navigationLayout);

    final TextField param1Field = new TextField("Parameter 1");
    final TextField param2Field = new TextField("Parameter 2");

    final Button homeButton = new Button("Home View",
            event -> getNavigator().navigateTo(HomeView.VIEW_NAME + "/" +
                    getParameters(param1Field.getValue(), param2Field.getValue())));
    navigationLayout.addComponent(homeButton);

    final Button parameterButton = new Button("Other View",
            event -> getNavigator().navigateTo(OtherView.VIEW_NAME + "/" +
                    getParameters(param1Field.getValue(), param2Field.getValue())));
    navigationLayout.addComponents(parameterButton, param1Field, param2Field);

    final Panel contentPanel = new Panel();
    contentPanel.setSizeFull();
    rootLayout.addComponent(contentPanel);
    rootLayout.setExpandRatio(contentPanel, 1.0f);

    setNavigator(HistoryApiNavigatorFactory.createHistoryApiNavigator(this, new CustomViewDisplay(contentPanel)));

    final HomeView homeView = new HomeView();
    getNavigator().addView(HomeView.VIEW_NAME, homeView);
    getNavigator().addView(OtherView.VIEW_NAME, new OtherView());

    setContent(rootLayout);
}
 
開發者ID:apm78,項目名稱:history-api-navigation,代碼行數:44,代碼來源:DemoUI.java


注:本文中的com.vaadin.ui.VerticalLayout.addComponents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。