1

在 vaadin 应用程序中,我使用 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);
                }
            });
4

0 回答 0