2013-04-18 207 views
1

我有一個窗口面板和我想設置圖像中it.so我做,GWT重疊圖像

Window window = new Window(); 
Panel panel = new Panel(); 
AbsolutePanel absolutePanel = new AbsolutePanel();  
Image image = new Image("img/heat_map.jpg"); 
absolutePanel.add(image); 
Image ap1Image = new Image("img/end.PNG"); 
ap1Image.getElement().getStyle().setMargin(1, Unit.PX); 
absolutePanel.add(ap1Image); 
panel.add(absolutePanel); 
window.add(panel); 

,但我卡在代碼作爲我不能重疊主圖像上的另一小圖標圖像( heat_map)。 我想onclick事件在該圖標image.but但我不能重疊窗口panel.please中的圖像幫我。

回答

1

看來你使用的東西像GXT不是純粹的GWT。但無論如何 - AbsolutePanel應實行類似的add(窗口小部件,詮釋離開,INT頂部)方法,所以你需要使用它,而不是簡單的插件(插件)

+0

謝謝你,我的工作。 – newavtar

0

第一件事是在你的代碼是你不能實例化GWT Window類,因爲構造函數Window()不是visible

第二件事是window class沒有添加方法。

最後重疊一張圖片上的另一則需要應用一些CSSZ-index..positions

CSS Divs overlapping, how do I force one above the other?

最後 您可以點擊處理程序簡單地添加到圖像。

imageIcon.addClickHandler(new ClickHandler() { 
      public void onClick(ClickEvent event) { 
       // Do something.... 
      } 
     }); 

祝你好運。

+0

感謝你,因爲我用GXT help.it的完成,它有增加( Widget,int left,int top)AbsolutePanel的方法。 – newavtar