• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JToolTip Problems

 
Terry McKee
Ranch Hand
Posts: 175
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have several components that make up a status bar at the bottom of JFrame. Each of these components have a JToolTip associated with them. When the JFrame is maximized I run into problems with the Tool Tips. It looks like by default, the Tooltips are shown just below the point where the mouse is located. I know that there must be a way to adjust this so the tool tips are located just above where the mouse is located (instead of below).

I have tried extending JToolTip and overriding the setVisible() method to check and adjust its location prior to displaying, but that doesn't work (in fact when debugging it doesn't even seem to execute this code).

I am going to try overriding the getLocation / setLocation methods and see if that works.

Does anyone have any suggestions?

Thanks,

Terry
 
Terry McKee
Ranch Hand
Posts: 175
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code seems passable for my situation:

public Point getToolTipLocation(MouseEvent event) {
Point result = null;
Component l_topFrame = MainView.this; //(Top Level Frame)
int l_topHeight = l_topFrame.getHeight();
if (l_topHeight > Toolkit.getDefaultToolkit().getScreenSize().getHeight() - 50)
{
result = new Point(0, 0);
}
return result;
}

I override this method in each of the components in my status bar. Does anyone know how to get the ToolTip above the actual component though?
[ September 29, 2005: Message edited by: Terry McKee ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic