LogPanel.java

gui/src/net/sourceforge/pain/tools/guitool/LogPanel.java · 572 B

From the archive pain_0_44.tgz

Download the archive   « Back to the archive contents

package net.sourceforge.pain.tools.guitool;

import javax.swing.*;
import java.text.*;
import java.util.*;

public class LogPanel extends JScrollPane {

	final JTextArea logArea;
	final DateFormat timeFormat;


	public LogPanel() {
		logArea = new JTextArea();
		logArea.setEditable(false);
		getViewport().add(logArea);
		timeFormat = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.MEDIUM);
	}

	public void message(String message) {
		message = "[" + timeFormat.format(new Date()) + "] " + message + "\n";
		logArea.append(message);
	}

}

Site Stats

Snippets: 1791
Codebases: 571