jdk/src/share/classes/javax/swing/text/GlyphPainter2.java
changeset 9216 d102bd3f513c
parent 5506 202f599c92aa
child 20103 f640c22218a3
equal deleted inserted replaced
9215:cab45ca6ab44 9216:d102bd3f513c
   170         Rectangle2D alloc = (a instanceof Rectangle2D) ? (Rectangle2D)a : a.getBounds2D();
   170         Rectangle2D alloc = (a instanceof Rectangle2D) ? (Rectangle2D)a : a.getBounds2D();
   171         //Move the y co-ord of the hit onto the baseline.  This is because TextLayout supports
   171         //Move the y co-ord of the hit onto the baseline.  This is because TextLayout supports
   172         //italic carets and we do not.
   172         //italic carets and we do not.
   173         TextHitInfo hit = layout.hitTestChar(x - (float)alloc.getX(), 0);
   173         TextHitInfo hit = layout.hitTestChar(x - (float)alloc.getX(), 0);
   174         int pos = hit.getInsertionIndex();
   174         int pos = hit.getInsertionIndex();
       
   175 
       
   176         if (pos == v.getEndOffset()) {
       
   177             pos--;
       
   178         }
       
   179 
   175         biasReturn[0] = hit.isLeadingEdge() ? Position.Bias.Forward : Position.Bias.Backward;
   180         biasReturn[0] = hit.isLeadingEdge() ? Position.Bias.Forward : Position.Bias.Backward;
   176         return pos + v.getStartOffset();
   181         return pos + v.getStartOffset();
   177     }
   182     }
   178 
   183 
   179     /**
   184     /**