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 4593994
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:45:55+00:00 2026-05-21T22:45:55+00:00

i am developing a GUI using Java Swing. but i got stuck here. Is

  • 0

i am developing a GUI using Java Swing. but i got stuck here.
Is it not possible to add text to the single “JTextArea” dynamically?

Ex:

class Sample extends JFrame{

    public static void fn(int n) {
        JFrame f = new JFrame();
        JTextArea ta = new JTextArea();
        f.add(ta);
        f.setVisible(true);
        for(int i=1;i<=n;i++){
           //some processing is done
         ta.setText(" step is done");
           // some other stuffs  
        }  
    }
}

this is just part of my source code. My problem here is , in this code for each iteration of the “for loop” i am getting a new frame with the text ” step is done”. but instead i want it to be displayed on a single frame ‘n; times.

  • 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-21T22:45:56+00:00Added an answer on May 21, 2026 at 10:45 pm

    setText() method sets the text, not appends its. You’ll have to do that manually:

    ta.setText(ta.getText() + "\nStep is done.");
    

    EDIT:

    My bad, I didn’t use Swing for a while and simply forgot about such a basic thing as append(). You should accept @Hovercraft Full Of Eels answer as it’s a correct and much better one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Swing/Java app but having difficulties passing data from the initiliaser
Possible Duplicate: How to programmatically close a JFrame I am developing a java GUI
When developing a desktop application in .NET, is it possible to not require the
I am developing a GUI application in C# using the design mode in VS2008.
Apologies in advance for the possible flame thread, but that's not what I'm going
I'm developing a GUI application rapidly using a GUI buidler (Netbeans). I am frustrated
I am developing a python app, using python and sqlite and GUI to re-create
I am developing a GUI in Vizard in which i am using radio buttons
I am developing a j2me application using LWUIT as GUI .... how can I
Here is the problem: The way the GUI system I'm using works is as

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.