Add a click handler to a HorizontalPanel in GWT
问题 How do i add click handlers to HorizontalPanel ? It worked with the use of addDomHandler() in newer GWT versions, but i had to downgrade to GWT 2.0.4 where this isn't supported. I used to do it like this: horizontalPanel.getWidget(1).addDomHandler(someClickHandler,ClickEvent.getType()); //or horizontalPanel.addDomHandler(someClickHandler, ClickEvent.getType()); 回答1: Use FocusPanels instead of hooking native events. To catch clicks for the whole panel: FocusPanel wrapper = new FocusPanel();