Package javax.swing.text

Examples of javax.swing.text.Segment


      return;
    }
    Map<Integer, Object> groupOperations = regExpRule.getGroupOperations();

    Pattern regExpPattern = regExpRule.getPattern();
    Matcher matcher = regExpPattern.matcher(new Segment(content, offset, length));
    while (matcher.find()) {
      // deal with the matched result
      for (int groupId : groupOperations.keySet()) {
        Object operation = groupOperations.get(groupId);
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.add(segment.toString());
        }
        historyIndex = history.size();
        inPipe.write(segment.array, segment.offset, segment.count);
        append("\n");
        outputMark = doc.getLength();
View Full Code Here

    public char[] getPassword()
    {
        // Igual que en JPasswordField, la verdad es que no entiendo bien por qu� no usa el getText normal
        Document doc = getDocument();
  Segment txt = new Segment();
        try
        {
            doc.getText(0, doc.getLength(), txt);
        }
        catch (BadLocationException ex)
View Full Code Here

        HashMap<Integer, Integer> comment = new HashMap<Integer, Integer>();
        HashMap<Integer, Integer> commentInLine = new HashMap<Integer, Integer>();
        StyledDocument doc = (StyledDocument) getDocument();

        String text = doc.getText(p0, p1 - p0);
        Segment segment = getLineBuffer();

        Matcher m = patternComment.matcher(doc.getText(0, doc.getLength()));
        int maxEnd = 0;
        while (m.find()) {
            comment.put(m.start(), m.end());
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

        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

        while (pos < p1) {
            if (lastCtx != ctx) {
                //syntax = context.getSyntaxName(lastCtx);
                g.setColor(context.getSyntaxForeground(lastCtx));
                g.setFont(context.getSyntaxFont(lastCtx));
                Segment text = getLineBuffer();
                doc.getText(mark, pos - mark, text);
                x = Utilities.drawTabbedText(text, x, y, g, this, mark);
                mark = pos;
            }
           
            pos = lexer.scan(ctx) + token.getStartOffset();
            lastCtx = ctx;
            ctx = lexer.getScanValue();
           
        }
       
        // flush remaining
        //syntax = context.getSyntaxName(lastCtx);
        g.setColor(context.getSyntaxForeground(lastCtx));
        g.setFont(context.getSyntaxFont(lastCtx));
        Segment text = getLineBuffer();
        doc.getText(mark, p1 - mark, text);
        x = Utilities.drawTabbedText(text, x, y, g, this, mark);
       
        return x;
    }
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.add(segment.toString());
        }
        historyIndex = history.size();
        inPipe.write(segment.array, segment.offset, segment.count);
        append("\n");
        outputMark = doc.getLength();
View Full Code Here

            int p1) throws BadLocationException {

        Document doc = getDocument();
        String text = doc.getText(p0, p1 - p0);

        Segment segment = getLineBuffer();

        SortedMap<Integer, Integer> startMap = new TreeMap<Integer, Integer>();
        SortedMap<Integer, Color> colorMap = new TreeMap<Integer, Color>();

        // Match all regexes on this snippet, store positions
View Full Code Here

        while (pos < p1) {
            if (lastCtx != ctx) {
                //syntax = context.getSyntaxName(lastCtx);
                g.setColor(context.getSyntaxForeground(lastCtx));
                g.setFont(context.getSyntaxFont(lastCtx));
                Segment text = getLineBuffer();
                doc.getText(mark, pos - mark, text);
                x = Utilities.drawTabbedText(text, x, y, g, this, mark);
                mark = pos;
            }
           
            pos = lexer.scan(ctx) + token.getStartOffset();
            lastCtx = ctx;
            ctx = lexer.getScanValue();
           
        }
       
        // flush remaining
        //syntax = context.getSyntaxName(lastCtx);
        g.setColor(context.getSyntaxForeground(lastCtx));
        g.setFont(context.getSyntaxFont(lastCtx));
        Segment text = getLineBuffer();
        doc.getText(mark, p1 - mark, text);
        x = Utilities.drawTabbedText(text, x, y, g, this, mark);
       
        return x;
    }
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.