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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:47:00+00:00 2026-05-23T01:47:00+00:00

I have simple test project which creates a frame and adds one JTextPane to

  • 0

I have simple test project which creates a frame and adds one JTextPane to it

When I select text and move mouse within JTextPane area all is fine, but when mouse leaves JTextPane area and I continue moving mouse up and down I have low performance. Selection is not smooth.

Is it normal for Java programs?

What should I do to fix this issue?

The code and result shown on image below

public class Main {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() { 
            @Override
            public void run() {
                Application app = new Application();
                app.run();
            }
        });
    }
}

class Application {
    protected JFrame frame;

    public Application(){
        frame = new JFrame("Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    public void run(){
        init();
        showFrame();
    }
    protected void init(){
        frame.setSize(new Dimension(1000,700));
        JTextPane textpane = new JTextPane();
        frame.add(textpane);
    }
    protected void showFrame(){
        this.frame.setVisible(true);
    }
}

screenshot

  • 1 1 Answer
  • 1 View
  • 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-23T01:47:00+00:00Added an answer on May 23, 2026 at 1:47 am

    Add the JTextPane to a JScrollPane and add the scroll pane to the frame.

    Edit:

    Misunderstood your issue. Yes, I do notice that the selection is a little slower.

    See the JComponent.setAutoscrolls(…) method. As the API says:

    synthetic mouse dragged events are generated when the mouse is dragged outside of a component’s bounds and the mouse button continues to be held down

    I guess the generation of these synthetic events is not as fast as the generation of a normal event so the selection isn’t as smooth. I don’t think there is anything you can do about this.

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

Sidebar

Related Questions

I have a simple question related to one-line programming. First an example: function test(a)
I have been struggling trying to test a super simple EJB project in netbeans.
I have a simple query which returns 25,026 rows: MySqlCommand cmd = new MySqlCommand(SELECT
I have a web service project and simple test application. I can debug the
I have setup a simple test project for the EF 4.1 RC, using Code-First
I have a simple little test app written in Flex 3 (MXML and some
I have written the following simple test in trying to learn Castle Windsor's Fluent
I have an extremely simple unit test. I'm not sure why it fails when
I have recorded a very simple test case Using the Selenium IDE integrated with
I have a very simple question. I want to test whether a particular port

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.