/* 	This file is part of jball.

	jball 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.

    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.karlsebal.jball;


import java.awt.Font;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
/**
 * just echo a string into a frame. close will exit application.
 * @author k
 *
 */
public class TinyConsole extends JFrame {
	JPanel panel;
	JTextArea text;
	String signature;

	public TinyConsole() {
		setTitle("~~~ TinyConsole ~~~");
		signature = "";
		panel = new JPanel();
		text = new JTextArea();
		text.setFont(new Font("monospaced", Font.PLAIN, 12));
		text.setEditable(false);

		setDefaultCloseOperation(EXIT_ON_CLOSE);
		panel.add(text);
		add(panel);
		setSize(250, 250);
		setVisible(true);
	}

	public void echo(String string) {
		string = string.concat(signature);
		text.setText(string);
		pack();
	}
	
	public void setSignature(String string) {
		signature = string;
	}
}