SelectionHandler<Widget> handler = new SelectionHandler<Widget>() {
@Override
public void onSelection(SelectionEvent<Widget> event) {
TabPanel panel = (TabPanel) event.getSource();
Widget w = event.getSelectedItem();
}
};
TabPanel content = new TabPanel();
content.addSelectionHandler(handler);
content.add(vpanel, "Normal");
widget = new VerticalPanel();
widget.setSpacing(10);
widget.add(content);
addSelectionHandler com.google.gwt.event.logical.shared.SelectionHandler> java.lang.Integer>不能应用于com.google.gwt.event.logical.shared.SelectionHandler
最佳答案
SelectionHandler
必须是Integer
类型,而不是Widget
(请参阅here)。它看起来应该像这样:
TabPanel panel = ...;
panel.addSelectionHandler(new SelectionHandler<Integer>()
{
@Override
public void onSelection(SelectionEvent<Integer> event)
{
}
});
要么
TabPanel panel = ...;
SelectionHandler<Integer> handler = new SelectionHandler<Integer>()
{
@Override
public void onSelection(SelectionEvent<Integer> event)
{
}
};
panel.addSelectionHandler(handler);