Vaadin水平布局不能很好地对齐

时间:2016-06-17 06:03:28

标签: layout vaadin

我正在尝试创建添加到Panel的TextField的水平布局,但它是垂直对齐的。

请参阅下面的代码;

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    TextField txtUsername = new TextField("Username");
    txtUsername.setRequired(true);
    horizontalLayout.addComponent(txtUsername);

    PasswordField txtPassword = new PasswordField("Password");
    txtPassword.setRequired(true);
    horizontalLayout.addComponent(txtPassword);

    horizontalLayout.setStyleName("formLayout");

    VerticalLayout panelLayout = new VerticalLayout(horizontalLayout);
    setContent(panelLayout);

This is what I get ...

0 个答案:

没有答案