Ejemplo n.º 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);
    }
  }
Ejemplo n.º 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;
    }
  }
Ejemplo n.º 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);
    }
  }
Ejemplo n.º 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();
  }