• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Position the tooltip

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have written a code for displaying a rectangle object and displaying tooltip on MouseOver. My problem is, on placing the mouse over the rectange object, the tooltip getting displayed on the top of the panel, then displaying over the object. How to avoid displaying on the top of the panel.

Here is my code.

 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure but I just found a similar thread here on ranch itself.

https://coderanch.com/t/465626/GUI/java/Tooltip-Line-or-Rectangle
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But that doesn't help me. still facing the same problem.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Regardless of all else, do NOT setBackground(...) or setdoubleBuffered(...) or otherwise change the state of the component in any way in a painting method override (line 51 of the posted code).

Also, adding a component to its viewport is NOT the correct way to use a JScrollPane. Read the API and follow the link to the tutorial to learn how to correctly use scroll panes.

You would also do well to get rid of all redundant code before posting on a forum.
  • setting the content pane's layout to BorderLayout -- which it is, by default (07)
  • setBackground calls that are irrelevant to the stated problem (11, 29, 51)
  • setColor(...) calls that each supersede tha last (48, 50, 53)


  • And if this is a standalone application, as evidenced by a main(...) method, why do you extend JApplet? Applets are meant for diaply in a browser.
     
    Neeba Rebbaca
    Ranch Hand
    Posts: 162
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for the reply.

    I'm debugging the code, so i added the main, actually it is a web application. Still I could not able to fix the problem. I would be very help if someone say me, where i went wrong.
    Thanks in advance.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic