Output not getting redirecting to proper Jtextarea

南楼画角 提交于 2019-12-02 03:00:28

In JumpHosts:

TextPanel textPanel = new TextPanel();

you create an instance of TextPanel which is referenced by no other object in the program. This is not either of the TextPanels you created in MainFrame.

You need to pass the TextPanels created in MainFrame, namely:

private TextPanel textPanel;
private TextPanel textPanel2;

into your JumpHosts constructor:

JumpHosts(TextPanel textPanel1, TextPanel textPanel2)

to be able to reference the same TextPanel as MainFrame does.

Response to Followup: You will need to pass your TextPanel first to your FormPanel constructor from within your MainFrame constructor. You will then need to modify your FormPanel contructor to pass the TextPanel to your JumpHosts constructor.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!