my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes problem with client server chat application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem with client server chat application" Watch "problem with client server chat application" New topic

problem with client server chat application

Keith Mc C

Joined: May 01, 2005
Posts: 23
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 and i used JFrameBuilder to design the GUI.

so heres the problem :
public static void main(String[] args)
Chat chatObj = new Chat();;
(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;

i know i cant say; from here so what should i do

thanks in advance if ANY1 could please help me out
I agree. Here's the link:
subject: problem with client server chat application
Similar Threads
making Thread of methods
Data from server is not sent to client
Help(Client Fails to read from Server)
why thread is in running or runnable state why it is not terminated ?