Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Ella Campbell   on Oct 02 In Java Category.

  
Question Answered By: Velma Adams   on Oct 02

Add a MouseMotionListener or MouseListener to each panel.
In the method
public void mouseMoved(MouseEvent e) of MouseMotionListener
public void mouseEntered(MouseEvent e) of MouseListener
add some sort of popup window with your text  dsiplayed.

Frame popup;

public void mouseEntered(MouseEvent e){
if (popup == null) {
popup = new Frame();
TextArea textArea = new TextArea("Some text to display
like a tooltip.");
frame.add(popup);
frame.pack();
}else{
frame.show();
}

}
public void mouseExited(MouseEvent e){
if (popup != null) frame.hide();
}

There are all kinds of ways to do this.

You could make a class that extends MouseAdapter then override the mouse...
methods to do the above and then add an instance of it as a MouseListener
to the panel.

Share: 

 
 
Didn't find what you were looking for? Find more on ToolTip Text on AWT Components Or get search suggestion and latest updates.


Tagged: