newavtar
newavtar

Reputation: 111

GWT overlapping images

i have one window panel and i want to set image in it.so i do,

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);

but i stuck in code as i can't overlap another small icon image on main image(heat_map). i want onclick event on that icon image.but i can't overlap images in window panel.please help me out.

Upvotes: 1

Views: 847

Answers (2)

sidney3172
sidney3172

Reputation: 86

It seems that you using something like GXT not pure GWT. But anyway - AbsolutePanel should implement something like add(Widget, int left, int top) method so you need use it instead of simple add(widget)

Upvotes: 1

Suresh Atta
Suresh Atta

Reputation: 122006

First thing is in your code is you can not instantiate GWT Window Class since the constructor Window() is not visible.

Second thing is there is no add method in window class.

And finally to overlap your images one on another you need to apply Some CSS (Z-index..positions )

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

And finally you can simply add a click handler to image.

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

Good luck.

Upvotes: 0

Related Questions