1 /* Copyright (C) 2003 Finalist IT Group
2 *
3 * This file is part of JAG - the Java J2EE Application Generator
4 *
5 * JAG is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * JAG is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with JAG; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 package com.finalist.jaggenerator;
19
20 import javax.swing.*;
21
22 /***
23 * Yet another logger implementation... ;)
24 * This logger logs to the JTextArea in the JAG gui.
25 *
26 * @author Michael O'Connor - Finalist IT Group
27 */
28 public class ConsoleLogger {
29
30 private JTextArea console;
31
32 /***
33 * Creates a ConsoleLogger.
34 * @param console
35 */
36 public ConsoleLogger(JTextArea console) {
37 this.console = console;
38 }
39
40 /***
41 * Appends a log to the end of the console.
42 * @param message the log message.
43 */
44 public void log(String message) {
45 console.append(message);
46 console.append("\n");
47 console.setCaretPosition(console.getText().length());
48 }
49
50 }