Archived

This topic is now archived and is closed to further replies.

Xorcist

[java] Console Input Question

Recommended Posts

Hi, I''m writing a simple relay chat "Broadcast" client/server application (using standard console). Everything works great, but I ran into a situation which is a bit unpleasant. If a user is typing a message while another message comes in, that message gets displayed and breaks the line on which the use was typing his/her message. This is due to the multi-threaded aspect. My question is, is there any way to nicely kill the currently typed line or overwrite it with incoming one, while pushing the line being typing down. Yeah I know I could use a GUI, but that''s not what I''m after. Any ideas? I tried outputting a newline and then the incoming message followed by another newline and the users name, but what ends up happening is that every incoming message dumps a new empty line there, which is worst than the previous case. Does Java have any console type commands to position the cursor and whatnot?

Share this post


Link to post
Share on other sites
If you want to do a chat, I suggest just creating a gui.

Another option is make a queue that received the messages from the net, and when you press enter, put your message at the end of the queue, and display what''s there. It won''t be automatically refreshing, but you won''t lose what you''re typing.

Share this post


Link to post
Share on other sites