MainFrame.java
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Event;
import java.awt.GridLayout;
import java.awt.ev
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 TextPanel
s you created in MainFrame
.
You need to pass the TextPanel
s 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.