Then in the constructor, you add the HTML and "X" into the
HorizontalPanel. Implement ClickListener interface on the subclass and
add it as a ClickListener to the "X" Image Widget. This will allow your
new DialogBox subclass to respond to the "onClick" event when someone
click your "X" cross. You also need to override the following member
functions:
setText(String ),getText(),setHtml(String ),getHtml() to set and get
the Caption from the new HTML Widget instead of the original.
The reason that you need to work with widgets is that this is the
safest way to get GWT event handling wired in. If you just merely add
the images as DOM objects, they will not react to events.
Hope that help.
Thanks
hitesh
So what we want is to put the HorizontalPanel were caption is placed in
line 1. Since panel is private, we cant really access it from the
subclass. However from line 2, it calls the add function from
SimplePanel class which then calls "setWidget(panel)". Thus you can
access is by calling getWidget().
So in your subclass constructor you should have something like this:
....
super();
Widget origPanel = getWidget(0);
HorizontalPanel horizPanel = new HorizontalPanel();
origPanel.add(horizPanel, DockPanel.NORTH);
...
Good luck