Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7540475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:39:11+00:00 2026-05-30T07:39:11+00:00

I am currently making this text-based rpg game with a simple GUI. I was

  • 0

I am currently making this text-based rpg game with a simple GUI. I was happy to find the good start at it but then there is something I stumbled upon that made me stop coding for a while.

If you are making this in console, you could easily use this code to pause the movements of the characters for a while, like:

System.out.println("[enemy]");
Thread.sleep(1000);
System.out.println("The local guard waves his sword and tries to stab you in the back, but you quickly parried and tried for a counterattack but you failed.");

If you are doing this on a JTextArea, you’d use the setText but
if you use Thread.sleep it doesnt work and coding setText again, would erase the old text and replace it with the new text, so the records of the fight will not be fully displayed on the game. Is there a way to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:39:12+00:00Added an answer on May 30, 2026 at 7:39 am

    for the setText part, you should have a variable which will hold the text and when you want to add a string, you append it and set the text again:

    String text ="[enemy]";
    textfield.setText(text);
    text+= "\nblablabla ..";
    textfield.setText(text);
    

    UPDATE:

    Some are suggesting to use the append method which is relatively good. Sometimes in the game you would like to append and sometimes replace the whole text (a new character talks), I would recommend something like this:

    textfield.setText("[enemy]\n");
    textfield.append("blablabla");
    
    //When someone else wanna talk:
    
    thread.Sleep(1000);
    textfield.setText("[me]\n");
    textfield.append("moreblablabla");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently making a web-based chat system but I've run into a problem. I
I'm currently making an iphone web app based on Google App Engine (python). I
I think this is a pretty simple question but I'm having trouble finding the
I'm currently making a word game for iOS that, when loading, reads in a
The sampled code below is for the GUI I am currently making. I have
I'm learning MVC and am currently making a simple SCRUM tracking system as I
I'm currently making a program that saves Chinese Words onto a text file. I
I'm currently making a C++ game. I have my main loop during which the
I'm currently making a front end to display license information for my companies software
I'm currently making a GWT project where I display some HTML in a RichTextArea

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.