• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to display hint message when put mouse over a button

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I want to do following thing: when put mouse over button,some hint message will appear,when mouse left,the message disappear.
i know it's easy to do if use Swing,but i must use just Awt.
Give me help and thanks for your help a lot.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rose,
This is going to be really hard to do just like the ToolTips in Swing with only AWT...
Personally, what I would do is make a TextArea that only displays help text down in the corner of my app somewhere, and then use a MouseMotionListener to detect what component I am over and send strings to the TextArea...
You could try and make ToolTips like the Swing ToolTips by using a MouseMotionListener, detecting what component you are over, and painting a rectangle and strings over the components on the screen. However, this is going to be much more difficult... you are going to have to ( at least ) mess with fonts, and possibly have to make special components so that you can paint over them... It's possible to do ( especially since the programmers at Sun did it in Swing ), it's just a bit more in depth...
HTH,
-Nate
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So your saying you can't have a rectangle or shape and have it displayed in a JPanel that has tooltips?
JPanel added to JFrame

Or do we have to make our own tooltips.
I was hoping just to extend JComponent for the shape and override paintComponent(Graphics g)

thanks roba
 
No, tomorrow we rule the world! With this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic