knoxowns's Profile
Reputation: -2
Dishonored
- Group:
- New Members
- Active Posts:
- 2 (0 per day)
- Joined:
- 15-December 11
- Profile Views:
- 150
- Last Active:
Dec 16 2011 03:42 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: A simple Chat program with Client/Server (GUI optional)
Posted 16 Dec 2011
pbl, on 15 December 2011 - 10:31 PM, said:I strongly suggest you redo your stuff
You need to copy the 5 classes even if you do not use the GUI ones
I could have make an Interface whereToReply and have the the GUI and the not GUI version to implement it, but I would have had to add two NonGui classes and the Interface to implement it.
So a better design for sure, no test if it is GUI mode or not, but I wanted to keep it simple.
I had all the 5 classes but I guess it was an IDE error as im testing it using netbeans now and its working ( was using Eclipse before ), thanks. -
In Topic: A simple Chat program with Client/Server (GUI optional)
Posted 15 Dec 2011
Hey there, IDE detects an error in the line 9 of this code block, it says "The method appendRoom(String) is undefined for the type ServerGUI : 2 quick fixes : - add cast to sg; - create method appendRoom(String) in type 'ServerGUI'".
private synchronized void broadcast(String message) { // add HH:mm:ss and \n to the message String time = sdf.format(new Date()); String messageLf = time + " " + message + "\n"; // display message on console or GUI if (sg == null) System.out.print(messageLf); else sg.appendRoom(messageLf); // append in the room window // we loop in reverse order in case we would have to remove a Client // because it has disconnected for (int i = al.size(); --i >= 0;) { ClientThread ct = al.get(i); // try to write to the Client if it fails remove it from the list if (!ct.writeMsg(messageLf)) { al.remove(i); display("Disconnected Client " + ct.username + " removed from list."); } } }
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
knoxowns hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
knoxowns has no profile comments yet. Why not say hello?