Hello,
I have created a GUI using the Netbeans GUI Builder and I have a JTextArea that I want to output to, but because I need to use threads I am doing a lot of processing in an external thread. I am having issues outputting data from the thread class to the JTextArea in my main GUI Class. Here is the most important code:
// In my MainGui class I have a public JTextArea
public javax.swing.JTextArea console;
console = new javax.swing.JTextArea();
//I also have a button on this GUI
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
Thread connect = new Thread(new ConnectThread());
connect.start();
//ConnectThread is my external Thread Class
}
//In ConnectThread
//It is thread so it implements Runnable
public class ConnectThread implements Runnable{
MainGui maingui = new MainGui();
public void run(){
maingui.console.append("test");
//Doesn't output to the text area!
}
}
Any help would be appreciated