Warz
Warz

Reputation: 7746

Vaadin Checkbox -- Add a newline on caption

I am trying to set the caption of a checkbox and i want to break at a certain point in the string to create a new line without waiting for the word wrap:

When i added the simple \n character to caption string it did not work.

        private CheckBox completeCheckbox;
completeCheckbox.setCaption("why wont this\n break");

Upvotes: 2

Views: 3183

Answers (2)

Christofer Dutz
Christofer Dutz

Reputation: 2365

I just had the same problem and the simple solution for this was to call "setCaptionAsHtml(true)" on the CheckBox instance and to set the caption using HTML code.

private CheckBox completeCheckbox = createMyCheckboxSomehowFunction();
completeCheckbox.setCaptionAsHtml(true);
completeCheckbox.setCaption("why wont this<br/>break");

The above code snippet should do what you want. At least it worked fine for me.

Upvotes: 1

mindandmedia
mindandmedia

Reputation: 6825

i think the solution is to use an Option Group

I just read that here

Upvotes: 0

Related Questions