2005-09-21  Lillian Angel  <[EMAIL PROTECTED]>

        * javax/swing/ToolTipManager.java
        (showTip): Fixed location of tooltip. Sometimes
        the ToolTip was being cut off.


On Wed, 2005-09-21 at 10:21 -0400, Lillian Angel wrote:
> I fixed this so the Tool Tips are painted in a better location.
> 
> 2005-09-21  Lillian Angel  <[EMAIL PROTECTED]>
> 
>         * javax/swing/ToolTipManager.java
>         (showTip): Added code to move currentPoint to a new place.
>         (getGoodPoint): Removed, not needed.
> 
> 
> On Tue, 2005-09-20 at 18:00 -0400, Lillian Angel wrote:
> > 2005-09-20  Lillian Angel  <[EMAIL PROTECTED]>
> > 
> >         * javax/swing/JPopupMenu.java
> >         (setVisible): If HeavyWeightPopup, setLightWeightPopupEnabled
> >         is false.
> >         * javax/swing/ToolTipManager.java
> >         (showTip): Change so toolTips on lightWeightPopups are
> >         added different than those on heavyWeightPopups.
> >         (canToolTipFit): Removed. This is not needed/used.
> > 
> > _______________________________________________
> > Classpath-patches mailing list
> > Classpath-patches@gnu.org
> > http://lists.gnu.org/mailman/listinfo/classpath-patches
> _______________________________________________
> Classpath-patches mailing list
> Classpath-patches@gnu.org
> http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: javax/swing/ToolTipManager.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/ToolTipManager.java,v
retrieving revision 1.18
diff -u -r1.18 ToolTipManager.java
--- javax/swing/ToolTipManager.java	21 Sep 2005 18:57:45 -0000	1.18
+++ javax/swing/ToolTipManager.java	21 Sep 2005 21:18:30 -0000
@@ -456,7 +456,7 @@
    */
   void showTip()
   {
-    if (!enabled || currentComponent == null
+    if (!enabled || currentComponent == null || !currentComponent.isEnabled()
         || (currentTip != null && currentTip.isVisible()))
       return;
 
@@ -465,18 +465,20 @@
       currentTip = ((JComponent) currentComponent).createToolTip();
 
     Container parent = currentComponent.getParent();
-    if (parent instanceof JPopupMenu)
-      setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled());
-    
-    // Moves currentPoint to an appropriate place
     Point p = currentPoint;
     Dimension dims = currentTip.getPreferredSize();
     Rectangle bounds = currentComponent.getBounds();
-    p.x = bounds.width - dims.width;
+    p.x += bounds.width - dims.width;
     p.y = bounds.height;
-        
+    
+    if (parent instanceof JPopupMenu)
+        setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled());
+       
     if (isLightWeightPopupEnabled())
       {
+        if (p.x < parent.getBounds().x)
+          p.x = 0;
+        
         JLayeredPane pane = ((JRootPane) SwingUtilities.
             getAncestorOfClass(JRootPane.class, currentComponent)).
             getLayeredPane();
@@ -507,6 +509,10 @@
       }
     else if (currentComponent.isShowing())
       {
+        Rectangle b = parent.getBounds();
+        if (p.x + dims.width > b.x + b.width)
+          p.x = b.x - dims.width;
+        
         SwingUtilities.convertPointToScreen(p, currentComponent);
         tooltipWindow = new JDialog();
         tooltipWindow.setContentPane(currentTip);
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to