Jump to content
  • Advertisement

Archived

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

Xorcist

[java] Console Input Question

This topic is 5559 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!