Java GUI - displaying text in a new window from another method
===

I have the following interface structure: a frame in which I can browse and choose some files (in a class file), when I press a button it reads the files (in a separate class file) and sends them for some processing (in another class file, the 3rd). The processing itself is irrelevant for this question.

When I press the processing button mentioned before, a new window (frame) launches. In that window I have a textarea in which I want to display some console output while the processing takes place, and then another text.

The method that draws the second frame is located in the 3rd class file, the processing one, is as following:

	public static void drawScenario(){
		final JPanel mainPanel2 = new JPanel();
		JPanel firstLine = new JPanel();
		JPanel secLine = new JPanel();

		mainPanel2.setLayout(new BoxLayout(mainPanel2, BoxLayout.Y_AXIS));
		mainPanel2.setBorder(new EmptyBorder(new Insets(5, 5, 5, 5)));
		mainPanel2.add(Box.createVerticalGlue());
		
		firstLine.setLayout(new BoxLayout(firstLine, BoxLayout.X_AXIS));
		firstLine.setBorder(new EmptyBorder(new Insets(5, 5, 5, 5)));
		firstLine.add(Box.createVerticalGlue());
		
		secLine.setLayout(new BoxLayout(secLine, BoxLayout.X_AXIS));
		secLine.setBorder(new EmptyBorder(new Insets(5, 5, 5, 5)));
		secLine.add(Box.createVerticalGlue());
		
		JTextArea textArea = new JTextArea("", 10, 40);
		textArea.setLineWrap(true);
		JScrollPane scrollPane = new JScrollPane(textArea); 
		scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		textArea.setEditable(false);
		
		JLabel label1 = new JLabel("Processing results:");
		
		firstLine.add(Box.createRigidArea(new Dimension(5,0)));
		firstLine.add(label1);
		firstLine.add(Box.createRigidArea(new Dimension(5,0)));
		
		secLine.add(textArea);
		secLine.add(Box.createRigidArea(new Dimension(5,0)));
		
		mainPanel2.add(firstLine);
		mainPanel2.add(Box.createRigidArea(new Dimension(0, 30)));
		mainPanel2.add(secLine);
		mainPanel2.add(Box.createRigidArea(new Dimension(0, 20)));
		
		JFrame frame = new JFrame("Test results");
		frame.setSize(400, 300);
		frame.setLocation(50,50);
		frame.setVisible( true );
		frame.add(mainPanel2);
		frame.pack();
		
	}

The processing method ( public static void compare(String txt1, String txt2) ) is also located in the same file, below the drawScenario() method. My question is, how do I print text from compare() to the TextArea of the drawScenario() method?

Also, the window doesn't completely draw itself (it displays a black column of sorts and doesn't draw the TextArea inside it) during the processing although I call drawScenario() before compare(). Is there a way I can fix that?

Thank you!