Alignment in Horizontal Panel

67 views
Skip to first unread message

Dominic Warzok

unread,
Oct 11, 2012, 4:40:06 AM10/11/12
to google-we...@googlegroups.com
Hi 
I want to align some Buttons to the Left in my HorizontalPanel.

This is my examplecode.

     public void onModuleLoad() {
   
    HorizontalPanel buttonsPanel = new HorizontalPanel();
   
    Button test1 = new Button("Test1");
    Button Test2 = new Button("Test me ");
    buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    buttonsPanel.setWidth("100%");
    buttonsPanel.add(test1);
    buttonsPanel.add(Test2);
    RootPanel.get("buttoncontainer").add(buttonsPanel);
   
    }

But in this way there is a lot of space between these Buttons. But I want them to stick together. Any Suggestions ? 

Andrei

unread,
Oct 11, 2012, 10:55:32 AM10/11/12
to google-we...@googlegroups.com
Use FlowPanel instead.

    FlowPanel buttonsPanel = new FlowPanel();
    buttonsPanel.addStyleName("menu");

In your CSS file:

    .menu input {
        float: left;
    }
Reply all
Reply to author
Forward
0 new messages