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

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

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

Segment.getBeginIndex介绍

暂无

代码示例

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

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

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

int firstIndex = seg.getBeginIndex() + (offs-start) - 1;
seg.setIndex(firstIndex);
char ch = seg.current();

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

int firstIndex = seg.getBeginIndex() + (offs-start) - 1;
seg.setIndex(firstIndex);
char ch = seg.current();

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

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

代码示例来源:origin: omegat-org/omegat

while (nleft > 0) {
  doc.getText(offs, nleft, seg);
  int i = seg.getBeginIndex();
  while ((i = defaultFont.canDisplayUpTo(seg, i, seg.getEndIndex())) != -1) {
    int cp = Character.codePointAt(seg, i - seg.getBeginIndex());
    int start = i;
    i += Character.charCount(cp);
      cpn = Character.codePointAt(seg, j - seg.getBeginIndex());
      ccn = Character.charCount(cpn);
      if (!defaultFont.canDisplay(cpn) && font.canDisplay(cpn)) {

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

/**
 * Creates a new DocumentWordTokenizer to work on a document
 * @param document The document to spell check
 */
public DocumentWordTokenizer(Document document) {
 this.document = document;
 //Create a text segment over the entire document
 text = new Segment();
 sentenceIterator = BreakIterator.getSentenceInstance();
 try {
  document.getText(0, document.getLength(), text);
  sentenceIterator.setText(text);
  // robert: use text.getBeginIndex(), not 0, for segment's first offset
  currentWordPos = getNextWordStart(text, text.getBeginIndex());
  //If the current word pos is -1 then the string was all white space
  if (currentWordPos != -1) {
   currentWordEnd = getNextWordEnd(text, currentWordPos);
   nextWordPos = getNextWordStart(text, currentWordEnd);
  } else {
   moreTokens = false;
  }
 } catch (BadLocationException ex) {
  moreTokens = false;
 }
}

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

offs += seg.getIndex() - seg.getBeginIndex();
return 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: org.nuiton.thirdparty/rsyntaxtextarea

int firstIndex = seg.getBeginIndex() + (offs-start) - 1;
seg.setIndex(firstIndex);
char ch = seg.current();

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

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

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

int firstIndex = seg.getBeginIndex() + (offs-start) - 1;
seg.setIndex(firstIndex);
char ch = seg.current();

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

int firstIndex = seg.getBeginIndex() + (offs-start) - 1;
seg.setIndex(firstIndex);
char ch = seg.current();

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

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

相关文章