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

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

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

Segment.first介绍

暂无

代码示例

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

char ch = seg.first();

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

char ch = seg.first();

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

@Override
public boolean isAutoActivateOkay(JTextComponent tc) {
  Document doc = tc.getDocument();
  char ch = 0;
  try {
    doc.getText(tc.getCaretPosition(), 1, s);
    ch = s.first();
  } catch (BadLocationException ble) { // Never happens
    ble.printStackTrace();
  }
  return (autoActivateAfterLetters && Character.isLetter(ch)) ||
      (autoActivateChars!=null && autoActivateChars.indexOf(ch)>-1);
}

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

char next = text.first();
for (text.first(); next != Segment.DONE; next = text.next()) {

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

char ch = seg.first();

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

char ch = seg.first();

代码示例来源:origin: antlr/antlrworks

final char c = text.first();
save(g);
t.drawToken(ATERenderingView.this, t, g, metrics,

代码示例来源:origin: de.sciss/syntaxpane

static int getSmartHomeOffset(JTextComponent target, SyntaxDocument sDoc,
      int dot) throws BadLocationException {
    Element el = sDoc.getParagraphElement(dot);
    Segment seg = new Segment();
    sDoc.getText(el.getStartOffset(),
        el.getEndOffset() - el.getStartOffset() - 1, seg);
    int homeOffset = 0;
    int dotLineOffset = dot - el.getStartOffset();
    boolean inText = false;
    // see the location of first non-space offset
    for (int i = 0; i < dotLineOffset; i++) {
      if (!Character.isWhitespace(seg.charAt(i))) {
        inText = true;
        break;
      }
    }
    // if we are at first char in line, or we are past the non space
    // chars in the line, then we move to non-space char
    // otherwise, we move to first char of line
    if (dotLineOffset == 0 || inText) {
      for (char ch = seg.first();
          ch != CharacterIterator.DONE && Character.isWhitespace(ch);
          ch = seg.next()) {
        homeOffset++;
      }
    }
    return el.getStartOffset() + homeOffset;
  }
}

代码示例来源:origin: de.sciss/jsyntaxpane

static int getSmartHomeOffset(JTextComponent target, SyntaxDocument sDoc,
      int dot) throws BadLocationException {
    Element el = sDoc.getParagraphElement(dot);
    Segment seg = new Segment();
    sDoc.getText(el.getStartOffset(),
        el.getEndOffset() - el.getStartOffset() - 1, seg);
    int homeOffset = 0;
    int dotLineOffset = dot - el.getStartOffset();
    boolean inText = false;
    // see the location of first non-space offset
    for (int i = 0; i < dotLineOffset; i++) {
      if (!Character.isWhitespace(seg.charAt(i))) {
        inText = true;
        break;
      }
    }
    // if we are at first char in line, or we are past the non space
    // chars in the line, then we move to non-space char
    // otherwise, we move to first char of line
    if (dotLineOffset == 0 || inText) {
      for (char ch = seg.first();
          ch != CharacterIterator.DONE && Character.isWhitespace(ch);
          ch = seg.next()) {
        homeOffset++;
      }
    }
    return el.getStartOffset() + homeOffset;
  }
}

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

char ch = seg.first();

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

char ch = seg.first();

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

if( Character.isJavaIdentifierPart( txt.first() ) )

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

if( Character.isJavaIdentifierPart( txt.first() ) )

相关文章