There are 2 classes:
public class InterpreterMediator1 { private String intemsg; public String getInteMSG() { return intemsg; } public void setIntemsg(String intemsg) { this.intemsg = intemsg; }} AND
public class InterpreterMediator2 { private NewJFrame frame; public InterpreterMediator2(NewJFrame frame) { this.frame = frame; } public void getStr() { InterpreterMediator1 im = new InterpreterMediator1(); String s = im.getInteMSG(); frame.setJTextArea1(s); }} The first of the Interpreter class takes some string and passes it to the second, so that it can be called in the JFrame and shoved this string into the text of the area. The problem is that the InterpreterMediator1 line comes correctly, but in InterpreterMediator2 I already get null if, for example, output what I received through System.out. The problem, apparently, is that when I try to show the string in InterpreterMediator2, it is still empty, therefore it is null, but I did not understand how to solve this problem. I tried to put Thread.sleep there, but it waits for the allotted time and shows me null, although the string should have already arrived. How can I get strings correctly in InterpreterMediator2?
The whole project is an interpreter of BASIC, to which I am trying to fasten GUI. The interpreter source code is very difficult for me, so I make stupid crutches in the form of classes of intermediaries that would pass the information displayed by the interpreter to JFrame ... If necessary, I will drop the code for everything else.