在JumpHosts中:
TextPanel textPanel = new TextPanel();
您创建一个实例,
TextPanel该实例在程序中没有其他对象引用。这不是
TextPanel您在中创建的
Mainframe。
您需要传递在中
TextPanel创建的
Mainframe,即:
private TextPanel textPanel;private TextPanel textPanel2;
到您的
JumpHosts构造函数中:
JumpHosts(TextPanel textPanel1, TextPanel textPanel2)
要能够引用 相同
TextPanel的
Mainframe一样。
对后续措施的响应:您需要将
TextPanel第一个传递给
FormPanel构造函数中的
Mainframe构造函数。然后,您将需要修改
FormPanel构造函数以将传递
TextPanel给
JumpHosts构造函数。



