|
What this is
Other links
The source codepackage org.apache.log4j.gui; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ import java.awt.Color; import java.awt.Image; import java.awt.Toolkit; import java.awt.BorderLayout; import javax.swing.*; import javax.swing.text.StyledDocument; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.MutableAttributeSet; import javax.swing.text.StyleConstants; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Enumeration; import java.util.ArrayList; import org.apache.log4j.*; public class LogTextPanel extends JPanel { private JScrollBar scrollBar; private JTextPane textPane; private JCheckBox cbxTail; private StyledDocument doc; private Hashtable fontAttributes; private int eventBufferMaxSize = 10000; private ArrayList eventBuffer = new ArrayList(eventBufferMaxSize); private int eventViewIndex = 0; public LogTextPanel() { constructComponents(); createDefaultFontAttributes(); } private void constructComponents() { // setup the panel's additional components... this.setLayout(new BorderLayout()); cbxTail = new JCheckBox(); cbxTail.setSelected(true); cbxTail.setText("Tail log events"); JPanel bottomPanel = new JPanel(); bottomPanel.add(cbxTail, null); textPane = new JTextPane(); textPane.setEditable(false); textPane.setText(""); doc = textPane.getStyledDocument(); scrollBar = new JScrollBar(JScrollBar.VERTICAL); this.add(bottomPanel, BorderLayout.SOUTH); this.add(scrollBar, BorderLayout.EAST); this.add(textPane, BorderLayout.CENTER); } public void setTextBackground(Color color) { textPane.setBackground(color); } public void setTextBackground(String v) { textPane.setBackground(parseColor(v)); } private void createDefaultFontAttributes() { Priority[] prio = Priority.getAllPossiblePriorities(); fontAttributes = new Hashtable(); for (int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.