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

The Archive Base Latest Questions

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

Code: Display display = new Display(); RowLayout rowLayout = new RowLayout(); Shell shell =

  • 0

Code:

        Display display = new Display();
        RowLayout rowLayout = new RowLayout();

        Shell shell = new Shell(display);
        shell.setLayout(rowLayout);

        Text textArea = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
        textArea.setLayoutData(new RowData(200, 200));


        shell.open();
        while(!shell.isDisposed()) {
            if(display.readAndDispatch()) {
                display.sleep();
            }
        }

        display.dispose();

Problem: Typing in text is dog slow. I literally have to wait 1 – 3 seconds to let the text widget lag behind displaying my text in snail steps. Am i doing something wrong ?

  • 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-31T18:39:31+00:00Added an answer on May 31, 2026 at 6:39 pm

    Your readAndDispatch loop is backwards. The documentation for Display#readAndDispatch() states that it:

    returns true if there is potentially more work to do, or false if the caller can sleep until another event is placed on the event queue.

    Thus, your loop should actually be:

    while(! shell.isDisposed())
    {
        if(! display.readAndDispatch())
        {
            display.sleep();
        }
    }
    

    My understanding of sleep() was that it should be fairly efficient about waking up when there’s a new event to service, but that’s certainly not a guarantee.

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

Sidebar

Related Questions

I expect that code to display New Version at every 3 seconds but it
hi i am new developer on android i have written code for display simple
I write calculator application. The source code is: TextView display = new TextView (this);
Here I wrote Java code to display duplicate numbers in a text file. Here
I am new to WPF. I have a code which displays a UI window
I have this code: def display(self): print self.doc.toprettyxml(indent= ) strigName ='/Users/my_user/Desktop/python/' + str(datetime.datetime.now()) +
I have this code to display the data retrieved from DB in accounts_view.php :
The following code should display the id out of the JSON-object, which I got
I have some code to display a long list of languages inside Rails form
I already have Java code to display and process data from a database. I

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.