org.netbeans.editor.Utilities.getNextWord()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(110)

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

Utilities.getNextWord介绍

暂无

代码示例

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

public static int getNextWord(JTextComponent c, int offset) throws BadLocationException {
  return getNextWord((BaseDocument) c.getDocument(), offset);
}

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

public static int getNextWord(JTextComponent c, int offset)
throws BadLocationException {
  int nextWordOffset = getNextWord((BaseDocument)c.getDocument(), offset);
  int nextVisualPosition = c.getUI().getNextVisualPositionFrom(c,
             nextWordOffset, null, javax.swing.SwingConstants.EAST, null);
  return (nextVisualPosition - 1 == nextWordOffset) ?  nextWordOffset : nextVisualPosition - 1;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf

static int nextCamelCasePosition(JTextComponent textComponent) {
  int offset = textComponent.getCaretPosition();
  Document doc = textComponent.getDocument();
  // Are we at the end of the document?
  if (offset == doc.getLength()) {
    return -1;
  }
  KeystrokeHandler bc = GsfEditorKitFactory.getBracketCompletion(doc, offset);
  if (bc != null) {
    int nextOffset = bc.getNextWordOffset(doc, offset, false);
    if (nextOffset != -1) {
      return nextOffset;
    }
  }
  
  try {
    return Utilities.getNextWord(textComponent, offset);
  } catch (BadLocationException ble) {
    // something went wrong :(
    ErrorManager.getDefault().notify(ble);
  }
  return -1;
}

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

public void actionPerformed(ActionEvent evt, JTextComponent target) {
    if (target != null) {
      Caret caret = target.getCaret();
      try {
        int dotPos = caret.getDot();
        dotPos = Utilities.getNextWord(target, dotPos);
        if (select) {
          caret.moveDot(dotPos);
        }
        else {
          caret.setDot(dotPos);
        }
      } catch (BadLocationException ex) {
        target.getToolkit().beep();
      }
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-editor

return Utilities.getNextWord(textComponent, offset);

代码示例来源: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 dotPos = caret.getDot();
        dotPos = Utilities.getNextWord(target, dotPos);
        if (caret instanceof BaseCaret){
          BaseCaret bCaret = (BaseCaret) caret;
          if (select) {
            bCaret.moveDot(dotPos);
          } else {
            bCaret.setDot(dotPos, false);
          }
        }else {
          if (select) {
            caret.moveDot(dotPos);
          } else {
            caret.setDot(dotPos);
          }
        }
      } catch (BadLocationException ex) {
        target.getToolkit().beep();
      }
    }
  }
}

相关文章