• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How to display hint message when put mouse over a button  RSS feed

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!