FileDocCategorySizeDatePackage
Log.javaAPI DocExample1060Tue Nov 13 16:41:20 GMT 2001None

Log

public class Log extends JPanel
Encapsulate a scrolling text area that ensures that new text, added at thebottom of the area is always visible on screen

Fields Summary
private JTextArea
text
Constructors Summary
public Log(int rows, int columns)

      text = new JTextArea( rows, columns );
      text.setEditable( false );

      setLayout( new BorderLayout() );
      add( new JScrollPane( text, 
                            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, 
                            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ),
           BorderLayout.CENTER );
   
Methods Summary
public voidappend(java.lang.String message)
Append String value to end of log Scroll area if necessary so that new text is visible. Scrolling is achieved by ensuring that the text caret is positioned at the end of the buffer.

      text.append( message );
      text.setCaretPosition( text.getText().length() );