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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:34:22+00:00 2026-05-30T06:34:22+00:00

I am working on a project that contains a feature in a JEditorPane or

  • 0

I am working on a project that contains a feature in a JEditorPane or similar that allows for the highlighting of certain areas of text and adding “annotations” for that text. These annotations would be similar to a comment. I would also try to include tooltips that show the actual text of the annotation

Example:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

I would highlight the first set of text “consectetur adipisicing elit,” add an annotation which would let me set a highlight color and add a tooltip with a comment. The same would happen with “ullamco laboris nisi ut aliquip” except that the color and comment would be different.

The editor should be able to display these multiple highlightings.

Can anyone point me in the right direction? Is there any library I can use to accomplish this easier?

Thanks,

David

  • 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-30T06:34:24+00:00Added an answer on May 30, 2026 at 6:34 am

    For any JTextComponent (JTextField, JTextPane, JEditorPane etc) you can use setHighLighter() and add highlights to it to indicate the text spans where your annotations belong. You can change the colour using different HighlightPainter objects.

    You could also set the tooltip text according to whether the mouse is over a highlight (annotation) by over-riding getToolTipText() and using viewToModel() to determine where in the text the mouse is pointing.

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

Sidebar

Related Questions

I'm working on a project that contains Thomas Brothers Map page and grid numbers.
I'm working with a project that contains about 30 unique modules. It wasn't designed
I am working on a project that has a class 'A' that contains a
I'm currently working on a project that contains many different Eclipse projects referencing each
I recently began working on a large project that contains a huge number of
I'm working with a Visual Studio C++ project that contains a number of HTML
I am working on a large project that contains many reference / look up
I'm working on a middle-sized project that contains several class libraries, database model and
I'm working on a project that has these attributes: jQuery driving the page Unity
Currently I am working on a python project that contains sub modules and uses

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.