gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 16:36:06 25 4
gpt4 key购买 nike

我是编程新手。

我有垂直面板。在垂直面板上添加了一个按钮(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();
}
});
<小时/>
    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
*/
}
});
}
}

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

最佳答案

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

关于java - 如何在Gwt的PopupPanel中添加取消按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8895228/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com