A horizontal scrollbar in the subWindow

Why the horizontal scrollbar is shown in the subWindow? See the picture below.

Here is my code:

        myWindow = new Window("New window");

        Table table = new Table("This is my Table");
        table.addContainerProperty("First Name", String.class,  null);
        table.addContainerProperty("Last Name",  String.class,  null);
        table.addContainerProperty("Year",       Integer.class, null);
        table.addItem(new Object[] {
            "Nicolaus","Copernicus",new Integer(1473)}, new Integer(1));
        table.addItem(new Object[] {
            "Tycho",   "Brahe",     new Integer(1546)}, new Integer(2));
        //the same lines
        table.addItem(new Object[] {
            "Isaac",   "Newton",    new Integer(1643)}, new Integer(55));    
        layout = new VerticalLayout();    

Tahnk you :wink:

That would be because the vertical scrollbar doesn’t increase the window width and as such the rest of the contents don’t fit anymore without a horizontal scrollbar. The effect is more obvious if you remove the margin from the subwindow’s contents:

        ((VerticalLayout) myWindow.getContent()).setMargin(false);

If you want to always have a vertical scrollbar you can assign some space for it through styling or a manually set window width.

How can I assign some space through styling? Maybe can you show me a simple example? Thanks :wink:

Well, that would depend on which version of Vaadin you are using and which default theme your theme inherits, but assuming it’s Vaadin 6 inheriting reindeer theme (in which I think the scrollbar is 17 pixels wide) you could do it something like this:


and adding something like this to your styles.css:

.mywindowstyle .v-scrollable {
	padding-right: 17px;
.mytablestyle .v-scrollable {
	padding-right: 0;

(The second one returns the table’s padding back to default, as the first one affects every scrollable element within the popup-window.)