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

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

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

Caret.getMagicCaretPosition介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Caret caret = yourTextComponent.getCaret();
Point p = caret.getMagicCaretPosition();
p.x += yourTextComponent.getLocationOnScreen().x;
p.y += yourTextComponent.getLocationOnScreen().y;

aFrameYourePositioning.setLocation(p);

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

int initialY = visible.y;
Caret caret = textArea.getCaret();
Point magicPosition = caret.getMagicCaretPosition();
int yOffset;

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

Point magicPosition = caret.getMagicCaretPosition();

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

mcp = c.getMagicCaretPosition();

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
  public boolean test() {
    return caret.getMagicCaretPosition() != null;
  }
});

代码示例来源:origin: org.apache.uima/uimaj-tools

@Override
public void actionPerformed(ActionEvent arg0) {
 Point caretPos = this.main.getTextArea().getCaret().getMagicCaretPosition();
 if (caretPos == null) {
  // No idea why this is needed. Bug in JTextArea, or my poor understanding of the magics of
  // carets. The point is null when the text area is first focused.
  this.main.showTextPopup(0, 0);
 } else {
  this.main.showTextPopup(caretPos.x, caretPos.y);
 }
}

代码示例来源:origin: stackoverflow.com

point = newCaret.getMagicCaretPosition();
System.out.println(point);

代码示例来源:origin: org.netbeans.api/org-jruby

end = area.getCaretPosition();
Point pos = area.getCaret().getMagicCaretPosition();

代码示例来源:origin: stackoverflow.com

Point p = textInput.getCaret().getMagicCaretPosition();
if (textPopupMenu.isVisible()) {
 SwingUtilities.convertPointToScreen(p, textInput);

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

int dot = caret.getDot();
Rectangle tgtRect = ((BaseTextUI)target.getUI()).modelToView(target, dot);
Point p = caret.getMagicCaretPosition();
if (p == null && tgtRect !=null) {
  p = new Point((int)tgtRect.x, (int)tgtRect.y);

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

int dot = caret.getDot();
Rectangle tgtRect = ((BaseTextUI) target.getUI()).modelToView(target, dot);
Point p = caret.getMagicCaretPosition();
if (p == null) {
  p = new Point((int) tgtRect.x, (int) tgtRect.y);

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

int dot = caret.getDot();
Rectangle tgtRect = ((BaseTextUI)target.getUI()).modelToView(target, dot);
Point p = caret.getMagicCaretPosition();

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

int dot = caret.getDot();
Rectangle tgtRect = ((BaseTextUI) target.getUI()).modelToView(target, dot);
Point p = caret.getMagicCaretPosition();
if (p == null) {
  p = new Point(tgtRect.x, tgtRect.y);

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

Caret caret = target.getCaret();
int dot = caret.getDot();
Point p = caret.getMagicCaretPosition();
if (p == null) {
  Rectangle r = target.modelToView(dot);

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

Caret caret = target.getCaret();
int dot = caret.getDot();
Point p = caret.getMagicCaretPosition();
if (p == null) {
  Rectangle r = target.modelToView(dot);

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

Caret caret = target.getCaret();
int dot = caret.getDot();
Point p = caret.getMagicCaretPosition();
if (p == null) {
  Rectangle r = target.modelToView(dot);

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

Caret caret = target.getCaret();
int dot = caret.getDot();
Point p = caret.getMagicCaretPosition();
if (p == null) {
  Rectangle r = target.modelToView(dot);

代码示例来源: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);
      }
    }
  }
}

相关文章