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
  • 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-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 fairly simple program based largely on a simple bluetooth test client
I have a simple example of PHP sessions and AJAX, which works when holding
I have a simple class that contains a hashmap: @XmlRootElement() public class Customer {
I have a simple combobox with a checkbox inside as such: <ComboBox Height=23 HorizontalAlignment=Left
Hi so i am using msVS++2010 and have been attempting to set up SFML
I am writing a relatively small and simple Windows Service, and using Moles to
Hello yeah I'm asking this question a second time, sorry about that but I
I am trying to compile a 64bit dll for use with a 64bit C#
I've used the conditional comments technique for my IE6/7/8 CSS hacks, so that the

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.