jwo.utils.gui
Class GUIHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by java.util.logging.StreamHandler
          extended by jwo.utils.gui.GUIHandler

public class GUIHandler
extends StreamHandler

Creates a frame containing logger output. This is updated dynamically whenever a call to a logger that has registered this handler is made.

Version:
2.3, 8th July, 2006.
Author:
Jo Wood

Constructor Summary
GUIHandler()
          Creates a GUI in which logger output is placed.
 
Method Summary
 void addStyle(String text, Style style)
          Adds a style that is triggered by the appearance of the given text.
 Style getDefaultStyle()
          Reports the default style used for console output.
 JFrame getGUI()
          Retrieves the GUI used to report logging output.
 void publish(LogRecord record)
          Publishes a LogRecord to a GUI.
 
Methods inherited from class java.util.logging.StreamHandler
close, flush, isLoggable, setEncoding, setOutputStream
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIHandler

public GUIHandler()
Creates a GUI in which logger output is placed.

Method Detail

addStyle

public void addStyle(String text,
                     Style style)
Adds a style that is triggered by the appearance of the given text.

Parameters:
text - Text to trigger style.
style - Style to be associated with any lines of output containing the text.

getDefaultStyle

public Style getDefaultStyle()
Reports the default style used for console output. This can be useful when adding further text triggered styles as they can inherit this default style.

Returns:
Default style used to display text in console.

publish

public void publish(LogRecord record)
Publishes a LogRecord to a GUI. The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.

Overrides:
publish in class StreamHandler
Parameters:
record - Description of the log event.

getGUI

public JFrame getGUI()
Retrieves the GUI used to report logging output.

Returns:
Frame holding console output.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009