贴代码吧,如果只是setContentPanel是不可能下标越界的,最多新Container替换旧Container.
见附图源码:
JFrame:
JRootPane
用代码说话。这样叫别人猜原因,怎么猜得出来?