javax.swing.text.Caret.setMagicCaretPosition()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中javax.swing.text.Caret.setMagicCaretPosition()方法的一些代码示例,展示了Caret.setMagicCaretPosition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Caret.setMagicCaretPosition()方法的具体详情如下:
包路径:javax.swing.text.Caret
类名称:Caret
方法名:setMagicCaretPosition

Caret.setMagicCaretPosition介绍

暂无

代码示例

代码示例来源:origin: bobbylight/RSyntaxTextArea

caret.setMagicCaretPosition(magicPosition);

代码示例来源:origin: bobbylight/RSyntaxTextArea

(direction == SwingConstants.NORTH ||
direction == SwingConstants.SOUTH)) {
  caret.setMagicCaretPosition(magicPosition);

代码示例来源:origin: net.java.abeille/abeille

public void actionPerformed(ActionEvent evt, JTextComponent target) {
    if (target != null) {
      Caret caret = target.getCaret();
      try {
        int dot = Utilities.getRowEnd(target, caret.getDot());
        if (select) {
          caret.moveDot(dot);
        }
        else {
          caret.setDot(dot);
        }
        // now move the magic caret position far to the right
        Rectangle r = target.modelToView(dot);
        Point p = new Point(Integer.MAX_VALUE / 2, r.y);
        caret.setMagicCaretPosition(p);
      } catch (BadLocationException e) {
        target.getToolkit().beep();
      }
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public void actionPerformed(ActionEvent evt, JTextComponent target) {
    if (target != null) {
      Caret caret = target.getCaret();
      try {
        int dot = javax.swing.text.Utilities.getRowEnd(target, caret.getDot());
        if (select) {
          caret.moveDot(dot);
        } else {
          caret.setDot(dot);
        }
        // now move the magic caret position far to the right
        Rectangle r = target.modelToView(dot);
        if (r!=null){
          Point p = new Point(Short.MAX_VALUE - 1, r.y);
          caret.setMagicCaretPosition(p);
        }
      } catch (BadLocationException e) {
        e.printStackTrace();
        target.getToolkit().beep();
      }
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

if (p == null && tgtRect !=null) {
  p = new Point((int)tgtRect.x, (int)tgtRect.y);
  caret.setMagicCaretPosition(p);
} else {
  p.y = (int)tgtRect.y;

代码示例来源:origin: net.java.abeille/abeille

if (p == null) {
  p = new Point((int) tgtRect.x, (int) tgtRect.y);
  caret.setMagicCaretPosition(p);

代码示例来源:origin: net.java.abeille/abeille

if (p == null) {
  p = new Point(tgtRect.x, tgtRect.y);
  caret.setMagicCaretPosition(p);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

caret.setMagicCaretPosition(p);
} else {
  p.y = tgtRect.y;

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

if (r!=null){
  p = new Point(r.x, r.y);
  caret.setMagicCaretPosition(p);
}else{
  return; // model to view failed

代码示例来源:origin: net.java.abeille/abeille

Rectangle r = target.modelToView(dot);
p = new Point(r.x, r.y);
caret.setMagicCaretPosition(p);

代码示例来源:origin: net.java.abeille/abeille

Rectangle r = target.modelToView(dot);
p = new Point(r.x, r.y);
caret.setMagicCaretPosition(p);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

if (r!=null){
  p = new Point(r.x, r.y);
  caret.setMagicCaretPosition(p);
}else{
  return; // model to view failed

代码示例来源:origin: OpenNMS/opennms

/**
   * The operation to perform when this action is triggered.
   *
   * @param e DOCUMENT ME!
   */
  public void actionPerformed(ActionEvent e) {
    JTextComponent target = getTextComponent(e);
    if (target != null) {
      // target.getUI().getNextVisualPositionFrom(t
      Caret caret = target.getCaret();
      int   dot   = caret.getDot();
      verticalAction.actionPerformed(e);
      if (dot == caret.getDot()) {
        Point magic = caret.getMagicCaretPosition();
        beginEndAction.actionPerformed(e);
        caret.setMagicCaretPosition(magic);
      }
    }
  }
}

代码示例来源:origin: org.opennms.features/org.opennms.features.remote-poller

/**
   * The operation to perform when this action is triggered.
   *
   * @param e DOCUMENT ME!
   */
  public void actionPerformed(ActionEvent e) {
    JTextComponent target = getTextComponent(e);
    if (target != null) {
      // target.getUI().getNextVisualPositionFrom(t
      Caret caret = target.getCaret();
      int   dot   = caret.getDot();
      verticalAction.actionPerformed(e);
      if (dot == caret.getDot()) {
        Point magic = caret.getMagicCaretPosition();
        beginEndAction.actionPerformed(e);
        caret.setMagicCaretPosition(magic);
      }
    }
  }
}

代码示例来源:origin: khuxtable/seaglass

/**
   * The operation to perform when this action is triggered.
   *
   * @param e DOCUMENT ME!
   */
  public void actionPerformed(ActionEvent e) {
    JTextComponent target = getTextComponent(e);
    if (target != null) {
      // target.getUI().getNextVisualPositionFrom(t
      Caret caret = target.getCaret();
      int   dot   = caret.getDot();
      verticalAction.actionPerformed(e);
      if (dot == caret.getDot()) {
        Point magic = caret.getMagicCaretPosition();
        beginEndAction.actionPerformed(e);
        caret.setMagicCaretPosition(magic);
      }
    }
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-editor

caret.setMagicCaretPosition(magicPosition);

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

caret.setMagicCaretPosition(magicPosition);

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

(direction == SwingConstants.NORTH ||
direction == SwingConstants.SOUTH)) {
  caret.setMagicCaretPosition(magicPosition);

代码示例来源:origin: org.codehaus.jtstand/jtstand-editor

(direction == SwingConstants.NORTH ||
direction == SwingConstants.SOUTH)) {
  caret.setMagicCaretPosition(magicPosition);

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

(direction == SwingConstants.NORTH ||
direction == SwingConstants.SOUTH)) {
  caret.setMagicCaretPosition(magicPosition);

相关文章