/[classpath]/classpath/javax/swing/ToolTipManager.java
ViewVC logotype

Diff of /classpath/javax/swing/ToolTipManager.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by langel, Wed Sep 21 18:57:45 2005 UTC revision 1.19 by langel, Wed Sep 21 21:21:19 2005 UTC
# Line 456  public class ToolTipManager extends Mous Line 456  public class ToolTipManager extends Mous
456     */     */
457    void showTip()    void showTip()
458    {    {
459      if (!enabled || currentComponent == null      if (!enabled || currentComponent == null || !currentComponent.isEnabled()
460          || (currentTip != null && currentTip.isVisible()))          || (currentTip != null && currentTip.isVisible()))
461        return;        return;
462    
# Line 465  public class ToolTipManager extends Mous Line 465  public class ToolTipManager extends Mous
465        currentTip = ((JComponent) currentComponent).createToolTip();        currentTip = ((JComponent) currentComponent).createToolTip();
466    
467      Container parent = currentComponent.getParent();      Container parent = currentComponent.getParent();
     if (parent instanceof JPopupMenu)  
       setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled());  
       
     // Moves currentPoint to an appropriate place  
468      Point p = currentPoint;      Point p = currentPoint;
469      Dimension dims = currentTip.getPreferredSize();      Dimension dims = currentTip.getPreferredSize();
470      Rectangle bounds = currentComponent.getBounds();      Rectangle bounds = currentComponent.getBounds();
471      p.x = bounds.width - dims.width;      p.x += bounds.width - dims.width;
472      p.y = bounds.height;      p.y = bounds.height;
473                
474        if (parent instanceof JPopupMenu)
475            setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled());
476          
477      if (isLightWeightPopupEnabled())      if (isLightWeightPopupEnabled())
478        {        {
479            if (p.x < parent.getBounds().x)
480              p.x = 0;
481            
482          JLayeredPane pane = ((JRootPane) SwingUtilities.          JLayeredPane pane = ((JRootPane) SwingUtilities.
483              getAncestorOfClass(JRootPane.class, currentComponent)).              getAncestorOfClass(JRootPane.class, currentComponent)).
484              getLayeredPane();              getLayeredPane();
# Line 507  public class ToolTipManager extends Mous Line 509  public class ToolTipManager extends Mous
509        }        }
510      else if (currentComponent.isShowing())      else if (currentComponent.isShowing())
511        {        {
512            Rectangle b = parent.getBounds();
513            if (p.x + dims.width > b.x + b.width)
514              p.x = b.x - dims.width;
515            
516          SwingUtilities.convertPointToScreen(p, currentComponent);          SwingUtilities.convertPointToScreen(p, currentComponent);
517          tooltipWindow = new JDialog();          tooltipWindow = new JDialog();
518          tooltipWindow.setContentPane(currentTip);          tooltipWindow.setContentPane(currentTip);

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26