P
Pkid
Hi
I am new to Java and threading. I am trying to write a GUI program
that does some networking using the NIO. I get the GUI to create a
new instance of my object that does the networking and then call the
start() method of that object to get the thread running. I want the
thread to be able to return data to the GUI so that I can display what
is happening in the thread on the GUI. So if a new connection is made
I want to display that in the a textarea in the GUI.
The code sort of looks like this:
In the constructor of the GUI I do the following:
MyNetworkClass newInstance = new MyNetworkClass
newInstance.start()
The network class would do something like:
public class MyNetworkClass extends Thread
{
public void run()
{
infinite loop handling networking events
}
}
I am new to Java and threading. I am trying to write a GUI program
that does some networking using the NIO. I get the GUI to create a
new instance of my object that does the networking and then call the
start() method of that object to get the thread running. I want the
thread to be able to return data to the GUI so that I can display what
is happening in the thread on the GUI. So if a new connection is made
I want to display that in the a textarea in the GUI.
The code sort of looks like this:
In the constructor of the GUI I do the following:
MyNetworkClass newInstance = new MyNetworkClass
newInstance.start()
The network class would do something like:
public class MyNetworkClass extends Thread
{
public void run()
{
infinite loop handling networking events
}
}