• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

JToolTip Problems

 
Ranch Hand
Posts: 175
  • 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
  • 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 ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!