0
if (checked) {
    int left = toothWidget.getToothImage().getAbsoluteLeft();       

    int top =  toothWidget.getVPanel().getAbsoluteTop();//toothWidget.getToothImage().getAbsoluteTop();
    Image im = new Image();                                         
    im.setUrl("images/"+ toothWidget.getToothNumber()+ menuItem.getImg());
    int offx = left;                                                
    int offy = top;                                                 
    final PopupPanel popup = new PopupPanel();                      
    popup.setStylePrimaryName("transparent");                       
    popup.setPopupPosition(Math.max(offx, 0),Math.max(offy, 0));    
    //popup.add(im);                                                
    ToothWidget wgt = new ToothWidget(toothWidget.getToothNumber(),toothWidget.getToothNumber()+menuItem.getImg(), toothWidget.getTeeth());
    toothWidget.getTeeth().getMap().get(toothWidget.getToothNumber()).put(menuItem.getName(), wgt);
    wgt.setMenu(toothWidget.getMenu());                             
    wgt.setPanel(popup);                                            
    popup.add(wgt);                                                 
    popup.show();                                                   
}                                                           
else {                                                      
    ToothWidget wgt = toothWidget.getTeeth().getMap().get(toothWidget.getToothNumber()).remove(menuItem.getName());
    wgt.getPanel().hide();                                          
}
4

1 回答 1

0

为什么不使用调试器来找出代码的哪一部分没有按预期工作?也许你的 else-block 没有到达,或者toothWidget.gePanel() 没有返回你的 PopupPanel..

于 2012-12-03T08:54:10.507 回答