tags:

views:

213

answers:

1

Is there a way to setPadding on GWT HorizontalPanel.
I wanted to just have 20px left padding and then add few buttons.
Currently I can only add setSpacing() and that puts padding on top,left,right,bottom.


-Thanks in advance!!

+1  A: 

You could (and should) use CSS for this, something like:

.paddedHorizontalPanel {
    padding-left: 20px;
}

And if you want every Button in that HorizontalPanel to be 20px apart, then you can try this instead:

.paddedHorizontalPanel .gwt-Button {
    margin-left: 20px;
}

And then add this style to you HorizontalPanel via hPanel.addStyleName("paddedHorizontalPanel"); More on CSS and GWT in the docs.

PS: AFAIK, not including setPadding was a concious choice on part of the GWT team - they wanted to leave the styling of the application entirely up to CSS.

Igor Klimer
Thanks Igor. your suggestion was very helpful.
adantu
No problem :) If this solved your problem, you should mark this as the answer to your question (click the tick next to the answer) - keeps the site clean (you know which questions are answered and which not).
Igor Klimer