How to set width for Vaadin Label with empty string

自作多情 提交于 2019-12-24 19:55:29

问题


According to the documentation if you have an empty Label (a Label with an empty string) the width will collapse to 0. That being said the documentation also says: "If you want a gap that has adjustable width or height, you can use an empty label if you specify a height or width for it" However when I do this the width still collapses to 0. I need the width to keep it's size because I use a different color for the background.


回答1:


For me adding style to whatEverIsTheStyleName.scss that specifies width works fine:

.emptyLabel {
    width: 500px;
}

Then simply:

emptyLabel.addStyleName("emptyLabel");

Setting it in a code like emptyLabel.setWidth(500, Unit.PIXELS); seems not to work.



来源:https://stackoverflow.com/questions/46870163/how-to-set-width-for-vaadin-label-with-empty-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!