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

x33g5p2x  于2022-01-30 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(107)

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

Segment.getIndex介绍

暂无

代码示例

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

seg.setIndex(firstIndex);
char ch = seg.current();
char nextCh = offs==end ? 0 : seg.array[seg.getIndex() + 1];
offs -= firstIndex - seg.getIndex() + 1;//seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE && nextCh!='\n') {
  offs++;

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

offs += seg.getIndex() - seg.getBeginIndex();
return offs;

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

return start; // Removed last "token" of the line
offs -= firstIndex - seg.getIndex();
return offs;

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

offs -= seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE) {
  offs++;

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

offs += seg.getIndex() - seg.getBeginIndex();
return offs;

代码示例来源:origin: net.sf.jazzy/jazzy

/** This helper method will return the start character of the next
 * word in the buffer from the start position
 */
private static int getNextWordStart(Segment text, int startPos) {
 if (startPos <= text.getEndIndex())
  for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
   if (Character.isLetterOrDigit(ch)) {
    return text.getIndex();
   }
  }
 return -1;
}

代码示例来源:origin: net.sf.jazzy/jazzy

/** This helper method will return the end of the next word in the buffer.
 *
 */
private static int getNextWordEnd(Segment text, int startPos) {
 for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
  if (!Character.isLetterOrDigit(ch)) {
   if (ch == '-' || ch == '\'') { // handle ' and - inside words
    char ch2 = text.next();
    text.previous();
    if (ch2 != Segment.DONE && Character.isLetterOrDigit(ch2))
     continue;
   }
   return text.getIndex();
  }
 }
 return text.getEndIndex();
}

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

seg.setIndex(firstIndex);
char ch = seg.current();
char nextCh = offs==end ? 0 : seg.array[seg.getIndex() + 1];
offs -= firstIndex - seg.getIndex() + 1;//seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE && nextCh!='\n') {
  offs++;

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

offs += seg.getIndex() - seg.getBeginIndex();
return offs;

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

offs -= seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE) {
  offs++;

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

offs += seg.getIndex() - seg.getBeginIndex();
return offs;

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

int foundIndex = text.getIndex() - text.getBeginIndex() + offset -
matchLowerCase.length + 1;
if (matchType == MatchType.CONTAINS) {

代码示例来源:origin: net.sf.jazzy/jazzy

/**
 * Sets the current word position at the start of the word containing
 * the char at position pos. This way a call to nextWord() will return
 * this word.
 * 
 * @param pos position in the word we want to set as current.
 */
public void posStartFullWordFrom(int pos){
  currentWordPos=text.getBeginIndex();
  if(pos>text.getEndIndex())
    pos=text.getEndIndex();
  for (char ch = text.setIndex(pos); ch != Segment.DONE; ch = text.previous()) {
    if (!Character.isLetterOrDigit(ch)) {
      if (ch == '-' || ch == '\'') { // handle ' and - inside words
        char ch2 = text.previous();
        text.next();
        if (ch2 != Segment.DONE && Character.isLetterOrDigit(ch2))
          continue;
      }
      currentWordPos=text.getIndex()+1;
      break;
    }
  }
  //System.out.println("CurPos:"+currentWordPos);
  if(currentWordPos==0)
    first=true;
  moreTokens=true;
  currentWordEnd = getNextWordEnd(text, currentWordPos);
  nextWordPos = getNextWordStart(text, currentWordEnd + 1);
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

int foundIndex = text.getIndex() - text.getBeginIndex();

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

seg.setIndex(firstIndex);
char ch = seg.current();
char nextCh = offs==end ? 0 : seg.array[seg.getIndex() + 1];
offs -= firstIndex - seg.getIndex() + 1;//seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE && nextCh!='\n') {
  offs++;

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

offs += seg.getIndex() - seg.getBeginIndex();
return offs;

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

return start; // Removed last "token" of the line
offs -= firstIndex - seg.getIndex();
return offs;

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

offs -= seg.getEndIndex() - seg.getIndex();
if (ch!=Segment.DONE) {
  offs++;

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

offs += seg.getIndex() - seg.getBeginIndex();
return offs;

相关文章