ui/src/main/java/ucar/nc2/ui/widget/TextHistoryPane.java
public void appendLine( String line) {

    if (count >= nlines) {
      try {
        int remove = Math.max(removeIncr, count - nlines); // nlines may have changed
        int offset = ta.getLineEndOffset( remove);
        ta.replaceRange( "", 0, offset);
      } catch (Exception e) {
        log.error("Problem in TextHistoryPane", e);
      }
      count = nlines - removeIncr;
    }
    ta.append(line);
    ta.append("\n");
    count++;

    // scroll to end
    ta.setCaretPosition(ta.getText().length());
  }
public void appendLine( String line) {

    if (count >= nlines) {
      try {
        int remove = Math.max(removeIncr, count - nlines); // nlines may have changed
        int offset = ta.getLineEndOffset( remove);
        ta.replaceRange( "", 0, offset);
      } catch (Exception e) {
        log.error("Problem in TextHistoryPane", e);
      }
      count = nlines - removeIncr;
    }
    ta.append(line);
    ta.append("\n");
    count++;

    // scroll to end
    ta.setCaretPosition(ta.getText().length());
  }
public void appendLine ( String line ) { if ( count >= nlines ) { try { int remove = Math . max ( removeIncr , count - nlines ) ; // nlines may have changed int offset = ta . getLineEndOffset ( remove ) ; ta . replaceRange ( "" , 0 , offset ) ; } catch ( Exception e ) { log . error ( "Problem in TextHistoryPane" , e ) ; } count = nlines - removeIncr ; } ta . append ( line ) ; ta . append ( "\n" ) ; count ++ ; // scroll to end ta . setCaretPosition ( ta . getText ( ) . length ( ) ) ; }
Append this line to the bottom of the JTextArea.
A newline is added and JTextArea is scrolled to bottom;
remove lines at top if needed.
@param line append this line. Ok to have multiple lines (ie embedded newlines)
but not too many.
Append this line to the bottom of the JTextArea . A newline is added and JTextArea is scrolled to bottom ; remove lines at top if needed .