我想在收到来自服务器的响应时向标签面板添加更多标签..问题是它只添加最后一个,而不是其他人看到下面代码的一部分。它似乎只是添加了最后一个面板“时间报告”而不是其他两个 谢谢
btnLogin.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
if(getLoginResult())
{
HorizontalPanel temp = new HorizontalPanel();
panel.add(temp, "Add Hours");
panel.add(temp, "Time Sheets");
panel.add(temp, "Time Reports");
}
}
});
RootPanel.get().add(panel);
}
private boolean getLoginResult() {
AsyncCallback callback = new AsyncCallback() {
public void onSuccess(Object result) {
isAuthenticated = true;
}
public void onFailure(Throwable caught) {
Window.alert("Error when invoking the pageable data service :" + caught.getMessage());
isAuthenticated = false;
}
};
timesheetLoginServlet.isAuthenticated("1","rapidjava", callback);
return isAuthenticated;
}
}
答案 0 :(得分:1)
您只能将任何窗口小部件添加到其父窗口一次。将temp更改为temp1,temp2和temp3