0
我是編程新手。如何在Gwt的PopupPanel中添加取消按鈕
我有垂直面板。一個按鈕(lblAddFolderIcon)被添加到verticalPanel和一些小部件。
點擊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
*/
}
});
}
}
PLZ建議一些代碼來關閉這個彈出窗口和 我的方法也是否正確。
彈出式面板上的取消按鈕?你確定你不想要一個對話框? – milan 2012-01-17 13:25:53
它應該是後面屏幕上顯示的窗口。如果對話框滿足需要,則會顯示爲 。 – NewCodeLearner 2012-01-17 13:35:10