有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Vaal网格高度太大

我有一个Vaadin(7.6.6)网格来显示一些java bean,它位于一个布局中

VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(true);
List<Booster> boosters = new ArrayList<>();
boosters.add(creaBoost("e"));
boosters.add(creaBoost("f"));
boosters.add(creaBoost("g"));
Grid grid = new Grid();
grid.setContainerDataSource(new BeanItemContainer<>(Booster.class, boosters));
grid.setWidth("80%");
grid.setSelectionMode(SelectionMode.MULTI);
grid.removeColumn("ident");
layout.addComponent(grid);

Button button = new Button("Delete", FontAwesome.WARNING);
button.setStyleName(ValoTheme.BUTTON_DANGER);
layout.addComponent(button);

结果如下 enter image description here 我在想,这个高度是从哪里来的?有没有办法减少它,只显示它需要的实际高度

理想情况下,它会考虑不高于X,这样如果网格中有更多的元素,它就不会不断增长

如何做到这一点


共 (0) 个答案