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

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

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

Segment.previous介绍

暂无

代码示例

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

/**
 * Removes any spaces or tabs from the end of the segment.
 *
 * @param segment The segment from which to remove tailing whitespace.
 * @return <code>segment</code> with trailing whitespace removed.
 */
private static Segment removeEndingWhitespace(Segment segment) {
  int toTrim = 0;
  char currentChar = segment.setIndex(segment.getEndIndex()-1);
  while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
    toTrim++;
    currentChar = segment.previous();
  }
  String stringVal = segment.toString();
  String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
  return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}

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

ch = seg.previous();
  } while (Character.isWhitespace(ch));
if (doc.isIdentifierChar(languageIndex, ch)) {
  do {
    ch = seg.previous();
  } while (doc.isIdentifierChar(languageIndex, ch));
      !doc.isIdentifierChar(languageIndex, ch) &&
      ch!=Segment.DONE) {
    ch = seg.previous();

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

ch = seg.previous();
if (doc.isIdentifierChar(languageIndex, ch)) {
  do {
    ch = seg.previous();
  } while (doc.isIdentifierChar(languageIndex, ch) &&
      ch != CharacterIterator.DONE);
    ch = seg.previous();
  } while (ch!=Segment.DONE &&
      !(doc.isIdentifierChar(languageIndex, ch) ||

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

ch = seg.previous();
} while (doc.isIdentifierChar(languageIndex, ch) && ch != CharacterIterator.DONE);
  ch = seg.previous();
} while (Character.isWhitespace(ch));

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

/**
 * Removes any spaces or tabs from the end of the segment.
 *
 * @param segment The segment from which to remove tailing whitespace.
 * @return <code>segment</code> with trailing whitespace removed.
 */
private static Segment removeEndingWhitespace(Segment segment) {
  int toTrim = 0;
  char currentChar = segment.setIndex(segment.getEndIndex()-1);
  while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
    toTrim++;
    currentChar = segment.previous();
  }
  String stringVal = segment.toString();
  String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
  return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}

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

/**
 * Removes any spaces or tabs from the end of the segment.
 *
 * @param segment The segment from which to remove tailing whitespace.
 * @return <code>segment</code> with trailing whitespace removed.
 */
private static Segment removeEndingWhitespace(Segment segment) {
  int toTrim = 0;
  char currentChar = segment.setIndex(segment.getEndIndex()-1);
  while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
    toTrim++;
    currentChar = segment.previous();
  }
  String stringVal = segment.toString();
  String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
  return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}

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

/**
 * Removes any spaces or tabs from the end of the segment.
 *
 * @param segment The segment from which to remove tailing whitespace.
 * @return <code>segment</code> with trailing whitespace removed.
 */
private static Segment removeEndingWhitespace(Segment segment) {
  int toTrim = 0;
  char currentChar = segment.setIndex(segment.getEndIndex()-1);
  while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
    toTrim++;
    currentChar = segment.previous();
  }
  String stringVal = segment.toString();
  String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
  return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}

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

ch = seg.previous();
  ch = seg.previous();
} while (Character.isLetterOrDigit(ch));
  ch = seg.previous();
} while (ch!=Segment.DONE &&
    !(Character.isLetterOrDigit(ch) ||

代码示例来源: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: 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.nuiton.thirdparty/rsyntaxtextarea

ch = seg.previous();
} while (Character.isLetterOrDigit(ch));
  ch = seg.previous();
} while (Character.isWhitespace(ch));

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

ch = seg.previous();
  } while (Character.isWhitespace(ch));
if (doc.isIdentifierChar(languageIndex, ch)) {
  do {
    ch = seg.previous();
  } while (doc.isIdentifierChar(languageIndex, ch));
      !doc.isIdentifierChar(languageIndex, ch) &&
      ch!=Segment.DONE) {
    ch = seg.previous();

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

ch = seg.previous();
if (doc.isIdentifierChar(languageIndex, ch)) {
  do {
    ch = seg.previous();
  } while (doc.isIdentifierChar(languageIndex, ch) &&
      ch != CharacterIterator.DONE);
    ch = seg.previous();
  } while (ch!=Segment.DONE &&
      !(doc.isIdentifierChar(languageIndex, ch) ||

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

ch = seg.previous();
} while (doc.isIdentifierChar(languageIndex, ch) && ch != CharacterIterator.DONE);
  ch = seg.previous();
} while (Character.isWhitespace(ch));

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

for (text.last(); previous != Segment.DONE; previous = text.previous()) {

相关文章