Package java.awt.font

Examples of java.awt.font.TextHitInfo


   * Move caret left by one character.
   * @param currPos the current position of the caret
   * @return true if caret moved else false
   */
  protected boolean moveCaretLeft(TextLayoutHitInfo currPos){
    TextHitInfo nthi = currPos.tli.layout.getNextLeftHit(currPos.thi);
    if(nthi == null){
      return false;
    }
    else {
      // Move the caret to the left of current position
View Full Code Here


   * Move caret right by one character.
   * @param currPos the current position of the caret
   * @return true if caret moved else false
   */
  protected boolean moveCaretRight(TextLayoutHitInfo currPos){
    TextHitInfo nthi = currPos.tli.layout.getNextRightHit(currPos.thi);
    if(nthi == null){
      return false;
    }
    else {
      currPos.thi = nthi;
View Full Code Here


  // Only executed if text has changed
  protected void changeText(){
    TextLayoutInfo tli;
    TextHitInfo thi = null, thiRight = null;

    pos += adjust;
    // Force layouts to be updated
    stext.getLines(buffer.g2);
View Full Code Here

  protected boolean moveCaretUp(TextLayoutHitInfo currPos){
    if(currPos.tli.lineNo == 0)
      return false;
    TextLayoutInfo ntli = stext.getTLIforLineNo(currPos.tli.lineNo - 1)
    TextHitInfo nthi = ntli.layout.hitTestChar(caretX, 0);
    currPos.tli = ntli;
    currPos.thi = nthi;
    return true;
  }
View Full Code Here

  protected boolean moveCaretDown(TextLayoutHitInfo currPos){
    if(currPos.tli.lineNo == stext.getNbrLines() - 1)
      return false;
    TextLayoutInfo ntli = stext.getTLIforLineNo(currPos.tli.lineNo + 1)
    TextHitInfo nthi = ntli.layout.hitTestChar(caretX, 0);
    currPos.tli = ntli;
    currPos.thi = nthi;
    return true;
  }
View Full Code Here

   * Move caret left by one character. If necessary move to the end of the line above
   * @return true if caret was moved else false
   */
  protected boolean moveCaretLeft(TextLayoutHitInfo currPos){
    TextLayoutInfo ntli;
    TextHitInfo nthi = currPos.tli.layout.getNextLeftHit(currPos.thi);
    if(nthi == null){
      // Move the caret to the end of the previous line
      if(currPos.tli.lineNo == 0)
        // Can't goto previous line because this is the first line
        return false;
View Full Code Here

   * Move caret right by one character. If necessary move to the start of the next line
   * @return true if caret was moved else false
   */
  protected boolean moveCaretRight(TextLayoutHitInfo currPos){
    TextLayoutInfo ntli;
    TextHitInfo nthi = currPos.tli.layout.getNextRightHit(currPos.thi);
    if(nthi == null){
      // Move the caret to the start of the next line the previous line
      if(currPos.tli.lineNo >= stext.getNbrLines() - 1)
        // Can't goto next line because this is the last line
        return false;
View Full Code Here

      invalidLayout = true;
    }
  }

  TextLayoutHitInfo calculateFromXY(Graphics2D g2d, float px, float py){
    TextHitInfo thi = null;
    TextLayoutInfo tli = null;
    TextLayoutHitInfo tlhi = null;
    if(invalidLayout)
      getLines(g2d);
    if(px < 0) px = 0;
View Full Code Here

        if (link == null) {
            return null;
        }

        TextLayout textLayout = getOrCreateTextLayout(line);
        TextHitInfo textHitInfo = textLayout.hitTestChar(x, y - line * lineHeight);
        int charIndex = textHitInfo.getCharIndex();
        if (charIndex >= link.startCharIndex && charIndex < link.endCharIndex) {
            return link;
        } else {
            return null;
        }
View Full Code Here

        int currentFeedback;
        int nextFeedback;
        int startOffset = 0;
        int currentOffset;
        int visiblePosition = 0;
        TextHitInfo visiblePositionInfo = null;

        rawFeedbacks.rewind();
        currentFeedback = rawFeedbacks.getNext();
        rawFeedbacks.unget();
        while ((nextFeedback = rawFeedbacks.getNext()) != -1) {
View Full Code Here

TOP

Related Classes of java.awt.font.TextHitInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.