这是我的gwt代码,如果我转到tabpanel中的另一个选项卡…弹出窗口仍然存在..我已附加快照 if(选中){ int left=toothWidget.getToothImage().getAbsoluteLeft(); int-top=toothWidget.getVPanel().getAbsoluteTop();//toothWidget.getTootThimage().getAbsoluteTop(); 图像im=新图像(); im.setUrl(“images/”+toothWidget.getToothNumber()+menuItem.getImg()); int offx=左; int offy=顶部; 最终PopupPanel弹出=新PopupPanel(); popup.setStylePrimaryName(“透明”); setPopupPopupPosition(Math.max(offx,0),Math.max(offy,0)); //弹出。添加(im); ToothWidget wgt=新的ToothWidget(ToothWidget.getToothNumber(),ToothWidget.getToothNumber()+menuItem.getImg(),ToothWidget.getTeeth()); toothWidget.getTeeth().getMap().get(toothWidget.getToothNumber()).put(menuItem.getName(),wgt); setMenu(toothWidget.getMenu()); wgt.setPanel(弹出窗口); 添加(wgt); popup.show(); } 否则{ ToothWidget wgt=ToothWidget.getTeeth().getMap().get(ToothWidget.getToothNumber()).remove(menuItem.getName()); wgt.getPanel().hide(); }

这是我的gwt代码,如果我转到tabpanel中的另一个选项卡…弹出窗口仍然存在..我已附加快照 if(选中){ int left=toothWidget.getToothImage().getAbsoluteLeft(); int-top=toothWidget.getVPanel().getAbsoluteTop();//toothWidget.getTootThimage().getAbsoluteTop(); 图像im=新图像(); im.setUrl(“images/”+toothWidget.getToothNumber()+menuItem.getImg()); int offx=左; int offy=顶部; 最终PopupPanel弹出=新PopupPanel(); popup.setStylePrimaryName(“透明”); setPopupPopupPosition(Math.max(offx,0),Math.max(offy,0)); //弹出。添加(im); ToothWidget wgt=新的ToothWidget(ToothWidget.getToothNumber(),ToothWidget.getToothNumber()+menuItem.getImg(),ToothWidget.getTeeth()); toothWidget.getTeeth().getMap().get(toothWidget.getToothNumber()).put(menuItem.getName(),wgt); setMenu(toothWidget.getMenu()); wgt.setPanel(弹出窗口); 添加(wgt); popup.show(); } 否则{ ToothWidget wgt=ToothWidget.getTeeth().getMap().get(ToothWidget.getToothNumber()).remove(menuItem.getName()); wgt.getPanel().hide(); },gwt,Gwt,为什么不使用调试器来找出代码的哪些部分不能按预期工作? 可能您的else块未到达,或者toothWidget.gePanel()未返回PopupPanel..Hi。欢迎来到StackOverflow。请使用“代码示例”标记,并确保您的问题具有可读性。另外,如果您正在使用GWT版本,还可以添加一些关于GWT版本的详细信息,即基于GWT的第三方JAR,等等。你有没有尝试过用构造函数参数true创建Popupanel?我已经尝试过了…但是如果我点击了上一个选项卡,弹出窗口就会消失,这意味着如果我转到下

为什么不使用调试器来找出代码的哪些部分不能按预期工作?
可能您的else块未到达,或者toothWidget.gePanel()未返回PopupPanel..

Hi。欢迎来到StackOverflow。请使用“代码示例”标记,并确保您的问题具有可读性。另外,如果您正在使用GWT版本,还可以添加一些关于GWT版本的详细信息,即基于GWT的第三方JAR,等等。你有没有尝试过用构造函数参数true创建Popupanel?我已经尝试过了…但是如果我点击了上一个选项卡,弹出窗口就会消失,这意味着如果我转到下一个选项卡,弹出窗口就会消失,如果我回到上一个选项卡,我希望弹出窗口仍然存在。。