Is there a way to set padding on GWT’s 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 and bottom.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could (and should) use CSS for this, something like:
And if you want every
Buttonin thatHorizontalPanelto be20pxapart, then you can try this instead:And then add this style to you
HorizontalPanelviahPanel.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.