GWT,在DockPanel&;从东到西将面板交换时出错;通过versa?
此代码出错GWT,在DockPanel&;从东到西将面板交换时出错;通过versa?,gwt,dockpanel,Gwt,Dockpanel,此代码出错 @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub mainDockPanel.remove(panel1); mainDockPanel.remove(panel2); if(mainDockPanel.getWidgetDirection(panel1).equals(DockPanel.EAST)){ mainDo
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
mainDockPanel.remove(panel1);
mainDockPanel.remove(panel2);
if(mainDockPanel.getWidgetDirection(panel1).equals(DockPanel.EAST)){
mainDockPanel.add(panel1, DockPanel.WEST);
mainDockPanel.add(panel2, DockPanel.EAST);
}
else if (mainDockPanel.getWidgetDirection(panel1).equals(DockPanel.WEST)){
mainDockPanel.add(panel1, DockPanel.EAST);
mainDockPanel.add(panel2, DockPanel.WEST);
}
}
这个代码有什么问题吗
另外,还有其他更好的方法来交换2面板吗?首先,您从mainDockPanel中删除了panel1。 然后使用
if(mainDockPanel.getWidgetDirection(panel1.equals)(DockPanel.EAST)){
来自API文档
小部件的布局方向,如果不是此面板的子项,则为null
大宗报价
很有可能,您得到了NPE您得到了什么错误?“未捕获异常转义”请将整个堆栈跟踪粘贴到问题中。