在vaadin应用程序中,我使用CropField插件来裁剪用户的头像。问题是每当我尝试测试它时,选择区域总是粘在cropfield的顶部。在一个页面上一切都很好但是当我将这段代码完全复制到另一个页面时,问题就出现了。你有什么想法吗?
NativeButton nb = new NativeButton("Click on me");
layout.addComponent(nb);
nb.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
final Window window = new Window();
window.setModal(true);
DivLayout cropContent = new DivLayout();
window.setContent(cropContent);
final CropField cropField = new CropField(new ExternalResource("http://upload.wikimedia.org/wikipedia/commons/1/1e/Stonehenge.jpg"));
cropField.setSelectionAspectRatio(1);
cropContent.addComponent(cropField);
//cropField.setImmediate(true);
NativeButton btClose = new NativeButton("Close");
btClose.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
getMyApplication().getMainWindow().removeWindow(window);
}
});
cropContent.addComponent(btClose);
getMyApplication().getMainWindow().addWindow(window);
}
});