public String getSelectedText() {
    if (!m_caret.isSelection()) {
      return "";
    }

    int lp = m_caret.getYmousePressed();
    int lr = m_caret.getYmouseReleased();

    if (lp > lr) {
      lp = m_caret.getYmouseReleased();
      lr = m_caret.getYmousePressed();
    }

    int pp = m_caret.getXmousePressed();
    int pr = m_caret.getXmouseReleased();

    if (pp > m_caret.getXmouseReleased()) {
      pp = m_caret.getXmouseReleased();
      pr = m_caret.getXmousePressed();
    }

    final StringBuilder selectedString = new StringBuilder();
    for (int y = lp; y <= lr; ++y) {
      final String line = getLineContent(y).getText();
      if ((line == null) || (line.length() < 1) || (line.length() < pp)) {
        selectedString.append("\n");
        continue;
      }

      if (line.length() < pr) {
        selectedString.append(line.substring(pp));
        if (!"\n".equals(line) && (y < lr)) {
          selectedString.append("\n");
        }
        continue;
      }

      selectedString.append(line.substring(pp, pr));
      if (!"\n".equals(line) && (y < lr)) {
        selectedString.append("\n");
      }
    }
    return selectedString.toString();
  }
Adds another line add the end of the label content.

@param line The line to add.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/zygraph/realizers/ZyLabelContent.java