Hi all,
About Vaadin 6.8.0, i want to center a little image using Alignment.MIDDLE_CENTER in gridLayout. The result is centered in the horizontal axis, but not centered in the vertical axis (see the screenshot below : the black image should be aligned with the number).
As the setComponentAlignment() function works fine with label here, i wonder if it is a bug ?
[size=2]
public class Test2vaadinApplication extends Application {
private static final long serialVersionUID = 1L;
@Override
public void init() {
final Window mainWindow = new Window("Myproject Application");
//mainWindow.setWidth(245);javascript:;
setMainWindow(mainWindow);
mainWindow.getContent().setSizeFull();
mainWindow.addComponent(new WindowOpener("Window Opener", mainWindow));
}
}
public class WindowOpener extends CustomComponent implements Window.CloseListener {
public WindowOpener(String label, Window main) { //constructor
Window mainwindow = main;
mainwindow.setSizeFull();
Embedded littleImage = new Embedded("", new ThemeResource("./little_image.jpg"));
Label label = new Label("4561");
GridLayout gridlayout = new GridLayout(2, 2);//(column, line)
gridlayout.setWidth("140px");
setCompositionRoot(gridlayout);
gridlayout.addComponent(littleImage, 0, 0);
[color=#dd1f6b]
gridlayout.setComponentAlignment(littleImage, Alignment.MIDDLE_CENTER);
[/color]
gridlayout.addComponent(label,1,0);
gridlayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
}
}
[/size]