Java 如何在Gwt中的PopupPanel中添加取消按钮

Java 如何在Gwt中的PopupPanel中添加取消按钮,java,gwt,smartgwt,gwt2,Java,Gwt,Smartgwt,Gwt2,我是编程新手 我有垂直面板。垂直面板上添加了一个按钮(lblAddFolderIcon)和一些小部件 单击b1时,应该会出现一个弹出面板,其中包含更多的小部件和两个带有“添加”和“取消”的按钮 我的代码: lblAddFolderIcon.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String childFolder = item.getT

我是编程新手

我有垂直面板。垂直面板上添加了一个按钮(lblAddFolderIcon)和一些小部件

单击b1时,应该会出现一个弹出面板,其中包含更多的小部件和两个带有“添加”和“取消”的按钮

我的代码:

   lblAddFolderIcon.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String childFolder = item.getText();
            String[] mainRepository=getPath(item);
            String objectId=item.getTitle();

            final AddFolderPopup addFolderPopup = new AddFolderPopup(childFolder,mainRepository[0],objectId);
            addFolderPopup.setHeight("300px");
            addFolderPopup.setWidth("502px");
            addFolderPopup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

                public void setPosition(int offsetWidth, int offsetHeight) {
                    // TODO Auto-generated method stub
                    int left = (Window.getClientWidth() - offsetWidth) / 3;
                    int top = (Window.getClientHeight() - offsetHeight) / 3;
                    addFolderPopup.setPopupPosition(left, top);
                }
            });
            //addFolderPopup.show();
            addFolderPopup.addFolderGui();
        }
    });

请建议一些代码来关闭这个弹出窗口 还有我的方法是否正确。

试着打电话给
hide()
在“取消”的onclick中,尝试调用
hide()

在单击处理程序的匿名类中的取消onclick中:
AddFolderPopup.this.hide()

在单击处理程序的匿名类中:
AddFolderPopup.this.hide()

弹出面板上的取消按钮?你确定你不想要一个对话框吗?它应该是后屏幕上的窗口。。若对话框满足需要,那个么就可以了。弹出面板上的取消按钮?你确定你不想要一个对话框吗?它应该是后屏幕上的窗口。。若对话框满足需要,那个么就可以了。
    public class AddFolderPopup extends PopupPanel {
VerticalPanel vpPopupl = new VerticalPanel();
private String childFolder;
private String mainRepository;
private String objectId;

public AddFolderPopup(){
    super(true);
}
public AddFolderPopup(String childFolder, String mainRepository, String objectId) {
    this.childFolder = childFolder;
    this.mainRepository = mainRepository;
    this.objectId = objectId;   

}
public void addFolderGui() {
         // some widget to design Gui and
      Button btnCancel = new Button("Cancel");
    btnCancel.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
                               /* i Dont Know what should i write here 
                                  so that this popupwindow is closed
                                */
                }
    });
      }
    }