Search code examples
javavaadinvaadin7

Button size with respect to button's text in Vaadin


I have a buttons that gets its caption with respect to locale. The problem is that the words are too long for my button in some languages. The question is, how can i change button's size so that it's width would be not less than text's width?


Solution

  • One solution is to just call vaadinButton.setSizeUndefined() which will work as width : auto; as change in caption will get reflected to the width of the button in this case.

    NOTE : After reviewing the comment of Henri Kerola stated below I must agree with the point that by default vaadin set the size undefined for button. So, if you does not specify the width it will be undefined by default.