X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FJalviewAppender.java;h=1f03c4c17c7207348f408b6a0f030eefefc8bf22;hb=ab43013b7e357b84b4abade0dba949668dfb2a0e;hp=8d3f990c8ac88c8d67f38f6a3c257ff47a34cad2;hpb=17c8e30466e7a52708ed95465151dd254617a7e4;p=jalview.git diff --git a/src/jalview/gui/JalviewAppender.java b/src/jalview/gui/JalviewAppender.java index 8d3f990..1f03c4c 100644 --- a/src/jalview/gui/JalviewAppender.java +++ b/src/jalview/gui/JalviewAppender.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) + * Copyright (C) 2014 The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.gui; import javax.swing.JTextArea; @@ -7,33 +27,37 @@ import org.apache.log4j.WriterAppender; import org.apache.log4j.spi.LoggingEvent; /** - * From http://textareaappender.zcage.com/ - * the means to capture the logs, too. - * Simple example of creating a Log4j appender that will - * write to a JTextArea. + * From http://textareaappender.zcage.com/ the means to capture the logs, too. + * Simple example of creating a Log4j appender that will write to a JTextArea. */ -public class JalviewAppender extends WriterAppender { - - static private JTextArea jTextArea = null; - - /** Set the target JTextArea for the logging information to appear. */ - static public void setTextArea(JTextArea jTextArea) { - JalviewAppender.jTextArea = jTextArea; - } - /** - * Format and then append the loggingEvent to the stored - * JTextArea. - */ - public void append(LoggingEvent loggingEvent) { - final String message = this.layout.format(loggingEvent); +public class JalviewAppender extends WriterAppender +{ + + static private JTextArea jTextArea = null; + + /** Set the target JTextArea for the logging information to appear. */ + static public void setTextArea(JTextArea jTextArea) + { + JalviewAppender.jTextArea = jTextArea; + } + + /** + * Format and then append the loggingEvent to the stored JTextArea. + */ + public void append(LoggingEvent loggingEvent) + { + final String message = this.layout.format(loggingEvent); - // Append formatted message to textarea using the Swing Thread. - SwingUtilities.invokeLater(new Runnable() { - public void run() { - if (jTextArea!=null) { - jTextArea.append(message); - } - } - }); + // Append formatted message to textarea using the Swing Thread. + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + if (jTextArea != null) + { + jTextArea.append(message); } -} \ No newline at end of file + } + }); + } +}