示例#1
0
  private void insertPuncAfterNonPunc(TextBlock tb, char c) {
    TextBlock bnx = tb.nextTextBlock();
    if (bnx instanceof PunctuationBlock) {
      insertPuncInPunc(bnx, c, 0);

    } else {
      addNewPuncBlockAfter(tb, c);
    }
  }
示例#2
0
  private void newline() {
    if (caretPos == 0) {
      TextBlock tbp = caretBlock.previousTextBlock();
      if (tbp != null) {
        tbp.newlineAfter();
      }

    } else if (caretPos == caretBlock.textLength()) {
      caretBlock.newlineAfter();
      caretBlock = caretBlock.nextTextBlock();
      caretPos = 1;

    } else {
      caretBlock.insertNewline(caretPos);
      caretBlock = caretBlock.nextTextBlock();
      caretPos = 1;
    }
  }
示例#3
0
  private void insertLetterAfterNonWord(TextBlock tb, char c) {
    TextBlock bnx = tb.nextTextBlock();
    if (bnx instanceof WordBlock) {
      insertLetterInWord(bnx, c, 0);

    } else {
      addNewWordBlockAfter(tb, c);
    }
  }
示例#4
0
  public void caretRight() {
    if (caretBlock == null) {
      return;
    }
    if (caretPos < caretBlock.textLength()) {
      caretPos += 1;
    } else {
      TextBlock tb = caretBlock.nextTextBlock();
      if (tb == null) {

      } else {
        caretBlock = tb;
        caretPos = 1;
      }
    }
    textBoard.repaint();
  }