我尝试将图标和标签放在一行中,但图标高一点。
这是我的尝试:
private VerticalLayout createActiveProductsCard() {
VerticalLayout layout = new VerticalLayout();
layout.setWidth("50px");
layout.setHeight("150px");
layout.getStyle().set("margin-bottom","20px");
layout.getStyle().set("border", "0.5px solid #9E9E9E");
Icon icon = new Icon(VaadinIcon.BARCODE);
icon.setSize("20px");
Label title = new Label("Produkte");
title.getStyle().set("font-size","20px");
HorizontalLayout horizontalLayout = new HorizontalLayout(icon, title);
horizontalLayout.setVerticalComponentAlignment(Alignment.AUTO);
layout.add(horizontalLayout);
return layout;
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,有人有解决方案吗?
我想将按钮与文本字段对齐在同一行上。项目对齐已设置为Alignment.CENTER,但正如您从图像中看到的,由于文本字段顶部的标签,它们的垂直中心较低。
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setAlignItems(FlexComponent.Alignment.CENTER);
Div div = new Div(buttonAddPriceRange);
horizontalLayout.add(spanneVon, spanneBis, div);
Run Code Online (Sandbox Code Playgroud)
如何使用 Junit 正确实施 Flyway?
我将 Flyway 添加到我的项目中,并将 V1__init.sql (例如)放入该**main**/resources/db/migration目录中。只要我调试我的代码(无需测试即可启动)它就可以工作。
我也必须将*.sql文件复制到**test**/resources/db/migration目录中吗?
我还希望针对另一个数据库(而不是测试数据库)进行测试。我是否正确,我必须在放置构建数据库凭据的文件夹application.properties下添加另一个文件(测试运行的位置?)。test
如果有人可以帮助我了解如何以正确的方式配置它,我会非常高兴。
如何让图标和文本在 Vaadin HorizontalLayout 内垂直对齐居中?
此代码不起作用:
HorizontalLayout horizontalLayout = new HorizontalLayout(VaadinIcon.EXCLAMATION_CIRCLE_O.create(),new H5("Achtung - Bitte aufmerksam lesen!") );
horizontalLayout.setAlignItems(FlexComponent.Alignment.CENTER);
Run Code Online (Sandbox Code Playgroud)
我向组件 (Vaadin 14) 添加了一个 iFrame,但 iFrame 是空的。这是我的代码,我也在没有 DIV 的情况下尝试过,但它不起作用。也没有错误信息,有人有提示吗?
Div div = new Div();
IFrame iFrame = new IFrame("https://google.de");
iFrame.setHeight("315px");
iFrame.setWidth("560px");
iFrame.getElement().setAttribute("frameborder", "1");
div.add(iFrame);
dialogContent.add(div);
Run Code Online (Sandbox Code Playgroud)