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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:01:40+00:00 2026-05-13T23:01:40+00:00

I have a component where i want to display a custom jtooltip. That is

  • 0

I have a component where i want to display a custom jtooltip. That is easy, just change the getTooltip method. Similar for location and text.

However i also want to change the timers. The tooltip should always be displayed if the mouse is over a cellrenderer of the component. If it leaves all of those it should be turned invisible.
I know that i can use TooltipManager to control the times globally. But the best solution is probably to just shortcircut that and display the tooltip myself with a mouselistener. However when i tried to do that (unregister the component in TooltipManager and setting the tooltip visible, with text and in the correct position, in a mouse listener) the tooltip never showed at all. What am i doing wrong?

Edit:
Now the question has changed! Into 2 questions.

My solution is for now this, however it losses the shadow that the jtooltip always displays sometimes frustratingly, and it is hidden if the mouse exits into the popup itself. How to filter the mouseexit events over the popup if the popup is not even a component? I could do some hacking based on the lastPosition, but that seems stupid, since i don’t really know its width.

    private Popup lastPopup;
    private final JToolTip tooltip = ...;
    private Point lastPoint;
   @Override public void mouseMoved(MouseEvent e) {
        Point p = privateToolTipLocation(e);
        if (p == null || p.equals(lastPoint)) {
            return;
        }
        lastPoint = p;
        tooltip.setTipText(privateToolTipText(e));
        //copy
        p = new Point(p);
        SwingUtilities.convertPointToScreen(p, this);
        Popup newPopup = PopupFactory.getSharedInstance().getPopup(this, tooltip, p.x, p.y);
        if (lastPopup != null) {
            lastPopup.hide();
        }
        lastPopup = newPopup;
        newPopup.show();
    }

    @Override public void mouseExited(MouseEvent e) {
        if (lastPopup != null && someUnknownCondiction) {
            lastPopup.hide();
            lastPopup = null;
        }
    }
  • 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-13T23:01:40+00:00Added an answer on May 13, 2026 at 11:01 pm

    Rather than trying to reimplement the display of tooltips, you could add a mouse listener to your component that changes the global tooltip timer when the mouse enters and leaves the region above the component.

    Here is some example code:

    instantTooltipComponent.addMouseListener(new MouseAdapter() 
    {    
        final int defaultTimeout = ToolTipManager.sharedInstance().getInitialDelay();
    
        @Override
        public void mouseEntered(MouseEvent e) {
            ToolTipManager.sharedInstance().setInitialDelay(0);
        }
    
        @Override
        public void mouseExited(MouseEvent e) {
            ToolTipManager.sharedInstance().setInitialDelay(defaultTimeout);
        }
    });
    

    This should change the tooltip delay to zero whenever the mouse moves over your component and change it back to the default delay whenever the mouse moves off of your component.

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

Sidebar

Related Questions

I have a component that i want to store to an SQLite database. public
Say I have a web component that uses jQuery and I want to distribute
I have a download-component and want the categories to display the subcats and item
I have my own custom UI that renders email. but it renders only text
I have a custom component that extends a panel. The panel has a top
I have a component and I want to make a textarea on the admin
I have a Delphi component which I want to install and have it available
I have a component written in C++ and I want to share an H
I have a s:List component. I want to handle a click event to know
I have WinForms app and multiple forms and want to use ErrorProvider component on

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.