gwtuibindergwt2

Reducing space between a label and list box in gwt


snapshot has a label and a listbox nxt to it

The environment is a label and and next to that is a list box in a horizontal panel. How can I reduce the space between these two? I tried with set spacing to 0 it doesn't seem to work.

And is there any way where I can add the title without using labels?


Solution

  • Here you go

    Horizontal Panel will create an table and if you gave the width on the panel with in that width widget will share the equal space .

    So

    Set the display type block so they will arrange in side by side in the whole width

        HorizontalPanel panel  = new HorizontalPanel();
        panel.setWidth("70%");
        panel.getElement().getStyle().setDisplay(Display.BLOCK);
        panel.add(new Label("Lable"));
        panel.add(listbox);
        RootPanel.get().add(panel);