package bcgTree.gui;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class BcgTree extends JFrame {
	private static final long serialVersionUID = 1L;

	public static void main(String[] args) {
		BcgTree mainWindow = new BcgTree();
		mainWindow.pack();
		mainWindow.setVisible(true);
	}
	
	public BcgTree(){
		initGUI();
	}
	
	public void initGUI(){
		// Basic settings
		this.setTitle("bcgTree");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setLayout(new BorderLayout());
		// Add title
		JLabel titleLabel = new JLabel("bcgTree v1.0.0");
		titleLabel.setHorizontalAlignment(JLabel.CENTER);
		this.add(titleLabel, BorderLayout.NORTH);
		// Add "Run" button
		JButton runButton = new JButton("Run");
		this.add(runButton, BorderLayout.SOUTH);
		runButton.addActionListener(runActionListener);
		// Add central panel (split in parameter section and log/output section)
		JPanel mainPanel = new JPanel();
		mainPanel.setLayout(new GridLayout(1, 2));
		this.add(mainPanel, BorderLayout.CENTER);
		JPanel settingsPanel = new JPanel();
		mainPanel.add(settingsPanel);
		JPanel logPanel = new JPanel();
		mainPanel.add(logPanel);
	}
	
	ActionListener runActionListener = new ActionListener() {		
		@Override
		public void actionPerformed(ActionEvent e) {
			System.out.println(System.getProperty("user.dir"));
			try {
				Process proc = Runtime.getRuntime().exec("perl "+System.getProperty("user.dir")+"/../bin/bcgTree.pl --help");
				InputStream stderr = proc.getInputStream();
	            InputStreamReader isr = new InputStreamReader(stderr);
	            BufferedReader br = new BufferedReader(isr);
	            String line = null;
	            while ( (line = br.readLine()) != null)
	                System.out.println(line);
	            int exitVal = proc.waitFor();
	            System.out.println("Process exitValue: " + exitVal);
			} catch (IOException | InterruptedException e1) {
				e1.printStackTrace();
			}
		}
	};

}

@@ -65,32 +65,58 @@
 awt.GridLayout;%0A
+import java.awt.TextArea;%0A
 import java.awt.
@@ -623,24 +623,56 @@
 le(true);%0A%09%7D
+%0A%0A%09private TextArea logTextArea;
 %0A%09%0A%09public B
@@ -1494,30 +1494,272 @@
 ;%0A%09%09
-mainPanel.add(logPanel
+logPanel.setLayout(new BorderLayout());%0A%09%09mainPanel.add(logPanel);%0A%09%09// Add Elements to settingsPanel%0A%09%09//TODO%0A%09%09// Add log textarea%0A%09%09logTextArea = new TextArea();%0A%09%09logTextArea.setEditable(false);%0A%09%09logPanel.add(logTextArea, BorderLayout.CENTER);%0A%09%09%0A%09%09this.pack(
 );%0A%09
@@ -2341,31 +2341,38 @@
     
-System.out.println(line
+logTextArea.append(line + %22%5Cn%22
 );%0A%09

Send output to log textArea instead of stdout