Question

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?

Was it helpful?

Solution 2

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);

OTHER TIPS

If you are using gwt with UIBinder then you can just set the spacing using css. To experiment, right-click in your browser and "inspect element", then experiment with margins, padding etc. until it looks right. Then you can set a class on the elements in gwt with label.setStyle("bla-bla") and set the margins/padding in your style sheet

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top