javavaadininsets

How to set insets


How can I set the insets to a Vaadin label.I have below developed.I want to have some space between the button and label.

        button_3 = new Button();
        button_3.setCaption("Button");
        button_3.setImmediate(true);
        button_3.setWidth("-1px");
        button_3.setHeight("-1px");
        horizontalLayout_4.addComponent(button_3);

        // prize_set_label
        prize_set_label = new Label();
        prize_set_label.setImmediate(false);
        prize_set_label.setWidth("-1px");
        prize_set_label.setHeight("-1px");
        prize_set_label.setValue("small:23");
        horizontalLayout_4.addComponent(prize_set_label);

Solution

  • To add spacing between components in (most) layouts, you can use setSpacing(boolean) - e.g. horizontalLayout_4.setSpacing(true);

    If you want to change the size of the spacing, you must change this in CSS.

    I don't understand what you are doing there with the size of the button & label; as far as I'm aware, setting the width/height to negative values is not valid in Vaadin.