Package javax.swing.text

Examples of javax.swing.text.Segment


   */
  public DocumentReader(Document document) {
    position = 0;
    mark = -1;
    this.document = document;
    this.segment = new Segment();
  }
View Full Code Here


    // Default insert trigger is a space.
    // FIXME:  See notes in RSyntaxTextAreaDefaultInputMap.
    setInsertTrigger(TEMPLATE_KEYSTROKE);

    s = new Segment();
    comparator = new TemplateComparator();
    templates = new ArrayList();

  }
View Full Code Here

      final char[] templateArray = t.getID().toCharArray();
      int i = 0;
      int len1 = templateArray.length;

      // Find "token" part of segment and get its offset and length.
      Segment s = (Segment)segment;
      char[] segArray = s.array;
      int len2 = s.count;
      int j = s.offset + len2 - 1;
      while (j>=s.offset && isValidChar(segArray[j])) {
        j--;
View Full Code Here

  private void markupSpelling(StyledDocument doc, int start, int end){
    int            wordStart=-1,
                wordEnd=-1;
    String          word;
    DocumentWordTokenizer  docTok;
    @SuppressWarnings("unused")
    Segment          seg=new Segment();
   
    docTok=new DocumentWordTokenizer(doc);
    if(start>0){
      docTok.posStartFullWordFrom(start);
    }
View Full Code Here

   * @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);
      currentWordPos = getNextWordStart(text, 0);
View Full Code Here


    synchronized void returnPressed() {
        Document doc = getDocument();
        int len = doc.getLength();
        Segment segment = new Segment();
        try {
            doc.getText(outputMark, len - outputMark, segment);
        } catch(javax.swing.text.BadLocationException ignored) {
            ignored.printStackTrace();
        }
        if(segment.count > 0) {
            history.addElement(segment.toString());
        }
        historyIndex = history.size();
        inPipe.write(segment.array, segment.offset, segment.count);
        append("\n");
        outputMark = doc.getLength();
View Full Code Here

    // Default insert trigger is a space.
    // FIXME:  See notes in RSyntaxTextAreaDefaultInputMap.
    setInsertTrigger(TEMPLATE_KEYSTROKE);

    s = new Segment();
    comparator = new TemplateComparator();
    templates = new ArrayList();

  }
View Full Code Here

      final char[] templateArray = t.getID().toCharArray();
      int i = 0;
      int len1 = templateArray.length;

      // Find "token" part of segment and get its offset and length.
      Segment s = (Segment)segment;
      char[] segArray = s.array;
      int len2 = s.count;
      int j = s.offset + len2 - 1;
      while (j>=s.offset && isValidChar(segArray[j])) {
        j--;
View Full Code Here

        final int startOffset = getStartOffset();
        final int endOffset = getEndOffset();

        final BreakIterator bi = BreakIterator.getWordInstance();
        final Segment text = getText(startOffset, endOffset);
        bi.setText(text);

        int prev;
        int curr = bi.first() - text.offset;
        int next;
View Full Code Here

    if (htmlScript) {
      synchronized (htmlScriptBrushList) {
        for (Brush htmlScriptBrush : htmlScriptBrushList) {
          Pattern _pattern = htmlScriptBrush.getHTMLScriptRegExp().getpattern();

          Matcher matcher = _pattern.matcher(new Segment(content, offset, length));
          while (matcher.find()) {
            // HTML-Script brush has superior priority, so remove all previous matches within the matched range
            removeMatches(matches, matcher.start() + offset, matcher.end() + offset);

            // the left tag of HTML-Script
View Full Code Here

TOP

Related Classes of javax.swing.text.Segment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.