It's not a secret anymore!
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 Java Interview Guide this week in the Jobs Discussion 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
jQuery in Action, 3rd edition