Package javax.swing.text

Examples of javax.swing.text.Caret.moveDot()


    int start = dot-len;
    String replacement = getReplacementText(c, textComp.getDocument(),
                        start, len);

    caret.setDot(start);
    caret.moveDot(dot);
    textComp.replaceSelection(replacement);
    /*
    Document doc = textComp.getDocument();
try {
    if (doc instanceof AbstractDocument) {
View Full Code Here


        if (caretPos==caret.getMark() && caretPos!=curLineEnd) {
          if (curLine==lastLine)
            caretPos = Math.min(caretPos+text.length(), curLineEnd);
          else
            caretPos = Math.min(caretPos+text.length(), curLineEnd-1);
          caret.moveDot(caretPos);//moveCaretPosition(caretPos);
        }

      } catch (BadLocationException ble) { // Never happens
        UIManager.getLookAndFeel().provideErrorFeedback(this);
        ble.printStackTrace();
View Full Code Here

        // Without this, if JTextArea isn't in focus, selection
        // won't appear selected.
        c.setSelectionVisible(true);
        pos = forward ? start+pos : pos;
        c.setDot(pos);
        c.moveDot(pos + text.length());
        return true;
      }
    }
    else {
      // Regex matches can have varying widths.  The returned point's
View Full Code Here

        c.setSelectionVisible(true);
        if (forward) {
          regExPos.translate(start, start);
        }
        c.setDot(regExPos.x);
        c.moveDot(regExPos.y);
        return true;
      }
    }

    // No match.
View Full Code Here

      if (forward) {
        matchStart += start;
        matchEnd += start;
      }
      c.setDot(matchStart);
      c.moveDot(matchEnd);
      textArea.replaceSelection(info.getReplacement());

      return true;

    }
View Full Code Here


    String replacement = getReplacementText(c, textComp.getDocument(), start, len);

    caret.setDot(start);
    caret.moveDot(dot);
    textComp.replaceSelection(replacement);

    if (isParameterAssistanceEnabled() &&
            (c instanceof ParameterizedCompletion)) {
      ParameterizedCompletion pc = (ParameterizedCompletion)c;
View Full Code Here

        if (caretPos==caret.getMark() && caretPos!=curLineEnd) {
          if (curLine==lastLine)
            caretPos = Math.min(caretPos+text.length(), curLineEnd);
          else
            caretPos = Math.min(caretPos+text.length(), curLineEnd-1);
          caret.moveDot(caretPos);//moveCaretPosition(caretPos);
        }

      } catch (BadLocationException ble) { // Never happens
        UIManager.getLookAndFeel().provideErrorFeedback(this);
        ble.printStackTrace();
View Full Code Here

        if (caretPos==caret.getMark() && caretPos!=curLineEnd) {
          if (curLine==lastLine)
            caretPos = Math.min(caretPos+text.length(), curLineEnd);
          else
            caretPos = Math.min(caretPos+text.length(), curLineEnd-1);
          caret.moveDot(caretPos);//moveCaretPosition(caretPos);
        }

      } catch (BadLocationException ble) { // Never happens
        UIManager.getLookAndFeel().provideErrorFeedback(this);
        ble.printStackTrace();
View Full Code Here

      getFilenameField().setText(fileName + jarName);
      Caret caret = getFilenameField().getCaret();

      caret.setDot(fileName.length());
      caret.moveDot(fileName.length() + jarName.length() - 4);

      getFilenameField().requestFocus();
    }
  }
View Full Code Here

        if (caretPos==caret.getMark() && caretPos!=curLineEnd) {
          if (curLine==lastLine)
            caretPos = Math.min(caretPos+text.length(), curLineEnd);
          else
            caretPos = Math.min(caretPos+text.length(), curLineEnd-1);
          caret.moveDot(caretPos);//moveCaretPosition(caretPos);
        }

      } catch (BadLocationException ble) { // Never happens
        UIManager.getLookAndFeel().provideErrorFeedback(this);
        ble.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.