Package net.sf.jpluck.util

Source Code of net.sf.jpluck.util.JEditTextAreaHandler

package net.sf.jpluck.util;

import org.syntax.jedit.JEditTextArea;
import org.syntax.jedit.SyntaxDocument;

import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.LogRecord;

import javax.swing.text.BadLocationException;


public class JEditTextAreaHandler extends Handler {
  private JEditTextArea textArea;
  private Formatter formatter;

  public JEditTextAreaHandler(JEditTextArea textArea, Formatter formatter) {
    this.textArea = textArea;
    this.formatter = formatter;
  }

  public void close() throws SecurityException {
  }

  public void flush() {
  }

  public synchronized void publish(LogRecord record) {
    try {
      SyntaxDocument document = textArea.getDocument();
      document.insertString(document.getLength(), formatter.format(record), null);
    } catch (BadLocationException e) {
    }
  }
}
TOP

Related Classes of net.sf.jpluck.util.JEditTextAreaHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.