Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Vaadin Panel have a 18px margin is it possible to remove it ?

Cristiano Fontes
1 decade ago Jul 14, 2011 3:37am
Jonas Granvik
1 decade ago Jul 14, 2011 5:12am

You have to alter or replace the content of a panel, which is the root element for the panel.

This is one way of doing it:

Panel panel = new Panel("My panel");
AbstractLayout panelLayout = (AbstractLayout) panel.getContent();
panelLayout.setMargin(false);

Label label = new Label("Yo, dude!");
panel.addComponent(label);
Last updated on Jul, 14th 2011
Cristiano Fontes
1 decade ago Jul 14, 2011 2:46pm
Basil Bourque
1 decade ago Oct 27, 2011 5:25am

For posterity…

"setMargin" adds/removes a default amount of space around the outside of the layout:

myLayout.setMargin( boolean ); 

"setSpacing" adds/removes a default amount of space between the widgets contained inside the layout:

myLayout.setSpacing( boolean ); 

These two options are the simple route (Java) to control spacing.
For finer tuning, you have to go the complex route: CSS and themes.

This regards Vaadin 6.
It's been suggested Vaadin 7 may include features for finer tuning on the Java side.

--Basil Bourque

Last updated on Oct, 27th 2011
Smac Afzal
1 decade ago Jul 16, 2012 12:14pm
Peter Lynch
9 years ago Nov 07, 2013 3:28pm
dileep kumar baratam
7 years ago Jun 22, 2015 7:01am
Jens Jansson
7 years ago Jun 22, 2015 7:17am
dileep kumar baratam
7 years ago Jun 22, 2015 7:29am
dileep kumar baratam
7 years ago Jun 22, 2015 7:33am
Jens Jansson
7 years ago Jun 22, 2015 8:17am
dileep kumar baratam
7 years ago Jun 22, 2015 8:39am