All pastes #424275 Raw Edit

Stuff

public java v1 · immutable
·published 2007-04-04 17:55 UTC
rendered paste body
package trader.gui;import java.awt.BorderLayout;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import javax.swing.SwingConstants;import org.apache.log4j.Logger;import trader.GuiLogService;public class GuiLogPanel extends JPanel implements GuiLogService{        /** Creates a new instance of LogPanel */    Logger logger;    // LogPanel Components    protected JLabel logLb;    protected JTextArea logTa= new JTextArea(9, 50);    protected JScrollPane logSp = new JScrollPane(logTa);        private String logName;        public GuiLogPanel(String logName) {        this.logName = logName;        buildLogPanel();        constructLogger();    }        void buildLogPanel() {        logLb = new JLabel(logName, SwingConstants.CENTER);        this.setLayout(new BorderLayout());        this.add(logLb, BorderLayout.NORTH);        this.add(logSp, BorderLayout.CENTER);    }        public void constructLogger(){        logger=Logger.getLogger("trader");        GuiLogHandler handler =        	(GuiLogHandler) logger.getAppender("mine");        handler.setServiceCallback(this);    }        public void setLog(String log){        logTa.setText(log);    }        public void addToLog(String newLogEvent){        logTa.append(newLogEvent);    }}