happy new year folks,
i am writing a client server chat application in which i am currently trying to do this :
public class Chat extends JFrame implements Runnable { .....
i'm not sure this is the best way possible but it is mainly because i am copying another example
TCPChat.java and i used JFrameBuilder to design the GUI.
so heres the problem :
public static void main(
String[] args)
{
Chat chatObj = new Chat();
chatObj.run();
}
(in main i am creating an instance of Chat and calling its run() method from main also -
but then every time there is a change of state in the connectionstatus i need to call the run method again from the below function ..? :
// The non-thread-safe way to change the GUI components while
// changing state
private static void changeStatusNTS(int newConnectStatus, boolean noError) {
// Change state if valid state
if (newConnectStatus != NULL) {
connectionStatus = newConnectStatus;
}
// If there is no error, display the appropriate status message
if (noError) {
statusString = statusMessages[connectionStatus];
}
// Otherwise, display error message
else {
statusString = statusMessages[NULL];
}
// Call the run() routine (Runnable interface) on the
// current
thread chatObj.run();
}
i know i cant say chatObj.run(); from here so what should i do
thanks in advance if ANY1 could please help me out