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

  • Home
  • SEARCH
  • 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 7531837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:16:48+00:00 2026-05-30T05:16:48+00:00

Thought of making a small textEditor. It will contain two textareas, one for entering

  • 0

Thought of making a small textEditor. It will contain two textareas, one for entering the text and one for error display. As for my understanding, SwingWorker works in background so there will be no delay in the UI updation. For checking, i wrote the below code and inserted 5000 lines and tried to type, i think as the line goes on increasing, the updation in textEditor2 is becoming very slow. Is the implementation of the swingworker is correct in the code?

textEditor1 and textEditor2 are JTextarea

 private void editorKeyPressed(java.awt.event.KeyEvent evt) {

SwingWorker worker = new SwingWorker<Void, Void>() {
    String text = null;

    @Override
    protected Void doInBackground() throws Exception {
        text = textEditor1.getText().toString();
        return null;
    }

    @Override
    protected void done() {
        try {
            get();
            textEditor2.setText(text);
        } catch (Exception ex) {
            System.out.println(ex);
        }
    }
};

worker.execute();   
}
  • 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-30T05:16:50+00:00Added an answer on May 30, 2026 at 5:16 am

    You are spawning worker threads every time the key is pressed, I expect that’s why you’re seeing the degradation in performance.

    You still need to manage the number of threads you’re executing to maintain UI responsiveness. If you want your background task to always be running, setup your own thread and use a class from the concurrent package to fascilitate passing data off of the Event thread (e.g. ArrayBlockingQueue).

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

Sidebar

Related Questions

I am making a small website as my first project. I have finalized to
In it's simplest explanation, I'm making a really small interactive movie app on Android.
I'm working on making a skeleton from which to build small to medium-sized sites
Very simple problem but I'm making no progress so I thought I should ask...
I'm looking for a really really small linux distribution or process of making my
I'm probably making a really simple error somewhere, but for some reason the event
I'm making a small business application and I'm wondering what the best interface would
I've worked on a program that uses databases to send small messages from one
I'm making a small project for my university which is supposed to enroll students
I'm making a small python game with pygame. I'd like to be able to

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.