亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? textpaneappender.java

?? log4j的源碼
?? JAVA
字號:
/* * Copyright 1999-2005 The Apache Software Foundation. *  * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *  *      http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.log4j.gui;import java.awt.Color;import java.awt.Image;import java.awt.Toolkit;import java.io.*;import java.net.URL;import java.util.Enumeration;import java.util.StringTokenizer;import java.util.Hashtable;import javax.swing.Icon;import javax.swing.ImageIcon;import javax.swing.JTextPane;import javax.swing.text.AttributeSet;import javax.swing.text.BadLocationException;import javax.swing.text.MutableAttributeSet;import javax.swing.text.SimpleAttributeSet;import javax.swing.text.StyleConstants;import javax.swing.text.StyledDocument;import javax.swing.text.TabSet;import javax.swing.text.TabStop;import org.apache.log4j.*;import org.apache.log4j.spi.LoggingEvent;import org.apache.log4j.helpers.Loader;import org.apache.log4j.helpers.QuietWriter;import org.apache.log4j.helpers.TracerPrintWriter;import org.apache.log4j.helpers.OptionConverter;/** * <b>Experimental</b> TextPaneAppender. <br> * * * Created: Sat Feb 26 18:50:27 2000 <br> * * @author Sven Reimers */public class TextPaneAppender extends AppenderSkeleton {      JTextPane textpane;  StyledDocument doc;  TracerPrintWriter tp;  StringWriter sw;  QuietWriter qw;  Hashtable attributes;  Hashtable icons;    private String label;    private boolean fancy;      final String LABEL_OPTION = "Label";  final String COLOR_OPTION_FATAL = "Color.Emerg";  final String COLOR_OPTION_ERROR = "Color.Error";  final String COLOR_OPTION_WARN = "Color.Warn";  final String COLOR_OPTION_INFO = "Color.Info";  final String COLOR_OPTION_DEBUG = "Color.Debug";  final String COLOR_OPTION_BACKGROUND = "Color.Background";  final String FANCY_OPTION = "Fancy";  final String FONT_NAME_OPTION = "Font.Name";  final String FONT_SIZE_OPTION = "Font.Size";    public static Image loadIcon ( String path ) {    Image img = null;    try {      URL url = ClassLoader.getSystemResource(path);      img = (Image) (Toolkit.getDefaultToolkit()).getImage(url);    } catch (Exception e) {      System.out.println("Exception occured: " + e.getMessage() + 			 " - " + e );       }	    return (img);  }    public TextPaneAppender(Layout layout, String name) {    this();    this.layout = layout;    this.name = name;    setTextPane(new JTextPane());    createAttributes();    createIcons();  }      public TextPaneAppender() {    super();    setTextPane(new JTextPane());    createAttributes();    createIcons();    this.label="";    this.sw = new StringWriter();    this.qw = new QuietWriter(sw, errorHandler);    this.tp = new TracerPrintWriter(qw);    this.fancy =true;  }  public  void close() {      }    private void createAttributes() {	    Priority prio[] = Priority.getAllPossiblePriorities();        attributes = new Hashtable();    for (int i=0; i<prio.length;i++) {      MutableAttributeSet att = new SimpleAttributeSet();      attributes.put(prio[i], att);      StyleConstants.setFontSize(att,14);    }    StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.ERROR),Color.red);    StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.WARN),Color.orange);    StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.INFO),Color.gray);    StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.DEBUG),Color.black);  }  private void createIcons() {    Priority prio[] = Priority.getAllPossiblePriorities();        icons = new Hashtable();    for (int i=0; i<prio.length;i++) {      if (prio[i].equals(Priority.FATAL))	icons.put(prio[i],new ImageIcon(loadIcon("icons/RedFlag.gif")));      if (prio[i].equals(Priority.ERROR))			icons.put(prio[i],new ImageIcon(loadIcon("icons/RedFlag.gif")));      if (prio[i].equals(Priority.WARN))			icons.put(prio[i],new ImageIcon(loadIcon("icons/BlueFlag.gif")));      if (prio[i].equals(Priority.INFO))			icons.put(prio[i],new ImageIcon(loadIcon("icons/GreenFlag.gif")));      if (prio[i].equals(Priority.DEBUG))			icons.put(prio[i],new ImageIcon(loadIcon("icons/GreenFlag.gif")));    }  }  public void append(LoggingEvent event) {    String text = this.layout.format(event);    String trace="";    // Print Stacktrace    // Quick Hack maybe there is a better/faster way?    if (event.throwable!=null) {      event.throwable.printStackTrace(tp);      for (int i=0; i< sw.getBuffer().length(); i++) {	if (sw.getBuffer().charAt(i)=='\t')	  sw.getBuffer().replace(i,i+1,"        ");      }      trace = sw.toString();      sw.getBuffer().delete(0,sw.getBuffer().length());    }    try {      if (fancy) {	textpane.setEditable(true);	textpane.insertIcon((ImageIcon)icons.get(event.priority));	textpane.setEditable(false);      }      doc.insertString(doc.getLength(),text+trace,		       (MutableAttributeSet)attributes.get(event.priority));	}	    catch (BadLocationException badex) {      System.err.println(badex);    }	    textpane.setCaretPosition(doc.getLength());  }    public  JTextPane getTextPane() {    return textpane;  }    private  static  Color parseColor (String v) {    StringTokenizer st = new StringTokenizer(v,",");    int val[] = {255,255,255,255};    int i=0;    while (st.hasMoreTokens()) {      val[i]=Integer.parseInt(st.nextToken());      i++;    }    return new Color(val[0],val[1],val[2],val[3]);  }    private  static  String colorToString(Color c) {    // alpha component emitted only if not default (255)    String res = ""+c.getRed()+","+c.getGreen()+","+c.getBlue();    return c.getAlpha() >= 255 ? res : res + ","+c.getAlpha();  }  public  void setLayout(Layout layout) {    this.layout=layout;  }    public  void setName(String name) {    this.name = name;  }        public  void setTextPane(JTextPane textpane) {    this.textpane=textpane;    textpane.setEditable(false);    textpane.setBackground(Color.lightGray);    this.doc=textpane.getStyledDocument();  }            private  void setColor(Priority p, String v) {    StyleConstants.setForeground(		      (MutableAttributeSet)attributes.get(p),parseColor(v));	  }    private  String getColor(Priority p) {    Color c =  StyleConstants.getForeground(		      (MutableAttributeSet)attributes.get(p));    return c == null ? null : colorToString(c);  }    /////////////////////////////////////////////////////////////////////  // option setters and getters    public  void setLabel(String label) {    this.label = label;  }  public  String getLabel() {    return label;  }    public  void setColorEmerg(String color) {    setColor(Priority.FATAL, color);  }  public  String getColorEmerg() {    return getColor(Priority.FATAL);  }    public  void setColorError(String color) {    setColor(Priority.ERROR, color);  }  public  String getColorError() {    return getColor(Priority.ERROR);  }    public  void setColorWarn(String color) {    setColor(Priority.WARN, color);  }  public  String getColorWarn() {    return getColor(Priority.WARN);  }    public  void setColorInfo(String color) {    setColor(Priority.INFO, color);  }  public  String getColorInfo() {    return getColor(Priority.INFO);  }    public  void setColorDebug(String color) {    setColor(Priority.DEBUG, color);  }  public  String getColorDebug() {    return getColor(Priority.DEBUG);  }    public  void setColorBackground(String color) {    textpane.setBackground(parseColor(color));  }  public  String getColorBackground() {    return colorToString(textpane.getBackground());  }    public  void setFancy(boolean fancy) {    this.fancy = fancy;  }  public  boolean getFancy() {    return fancy;  }    public  void setFontSize(int size) {    Enumeration e = attributes.elements();    while (e.hasMoreElements()) {      StyleConstants.setFontSize((MutableAttributeSet)e.nextElement(),size);    }    return;  }    public  int getFontSize() {    AttributeSet attrSet = (AttributeSet) attributes.get(Priority.INFO);    return StyleConstants.getFontSize(attrSet);  }    public  void setFontName(String name) {    Enumeration e = attributes.elements();    while (e.hasMoreElements()) {      StyleConstants.setFontFamily((MutableAttributeSet)e.nextElement(),name);    }    return;  }    public  String getFontName() {    AttributeSet attrSet = (AttributeSet) attributes.get(Priority.INFO);    return StyleConstants.getFontFamily(attrSet);  }  public  boolean requiresLayout() {    return true;  }} // TextPaneAppender

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
无码av免费一区二区三区试看 | 日本大香伊一区二区三区| 色综合视频在线观看| 制服丝袜日韩国产| 亚洲视频免费在线观看| 国产精品系列在线观看| 欧美久久久久免费| 一区二区在线看| 丰满岳乱妇一区二区三区| 91精品婷婷国产综合久久性色 | 国产日韩欧美综合一区| 日韩vs国产vs欧美| 精品视频1区2区3区| 亚洲人精品午夜| 成人免费高清视频| 国产性色一区二区| 国产精品综合一区二区三区| 欧美一区二区三区免费视频| 亚洲一区二区三区四区不卡 | 九九在线精品视频| 欧美精品电影在线播放| 亚洲午夜激情av| 色就色 综合激情| 亚洲免费在线看| 99精品一区二区| 亚洲欧洲av一区二区三区久久| 国内外成人在线视频| 精品99一区二区| 激情文学综合网| 精品少妇一区二区三区 | 亚洲综合网站在线观看| 91久久线看在观草草青青| 亚洲欧美另类综合偷拍| 91美女福利视频| 一区二区三区美女视频| 亚洲精品一区二区精华| 国产在线日韩欧美| 26uuu成人网一区二区三区| 经典三级视频一区| 亚洲国产精品v| av日韩在线网站| 一区二区三区免费| 91精品国产一区二区人妖| 免费在线欧美视频| 国产亚洲va综合人人澡精品| 成人精品国产福利| 亚洲一二三四区| 日韩一级免费观看| 国产精品69毛片高清亚洲| 国产精品免费看片| 欧洲色大大久久| 麻豆中文一区二区| 欧美国产一区二区| 日本道精品一区二区三区| 丝瓜av网站精品一区二区| 精品欧美一区二区在线观看| 成人黄色国产精品网站大全在线免费观看| 国产精品久久99| 欧美人妖巨大在线| 国产精品一区二区无线| 亚洲乱码国产乱码精品精98午夜| 欧美色国产精品| 国产精品自拍网站| 亚洲国产一区在线观看| 久久精品这里都是精品| 色激情天天射综合网| 另类小说综合欧美亚洲| 日韩一区在线免费观看| 欧美一区二区久久| av一区二区久久| 国内精品伊人久久久久av影院| 亚洲欧美日韩在线不卡| 精品国产亚洲一区二区三区在线观看| 粉嫩一区二区三区性色av| 亚洲电影视频在线| 国产精品网站在线观看| 制服.丝袜.亚洲.中文.综合| 本田岬高潮一区二区三区| 日本不卡一二三| 一区二区三区av电影 | 亚洲视频电影在线| 欧美不卡一二三| 欧美三级午夜理伦三级中视频| 国产福利91精品一区| 蜜桃久久久久久| 亚洲欧美日韩人成在线播放| 欧美精品一区二区在线观看| 欧美亚洲综合在线| 成人av免费在线观看| 九色porny丨国产精品| 天堂va蜜桃一区二区三区漫画版 | wwww国产精品欧美| 欧美人体做爰大胆视频| 色欧美片视频在线观看| 国产成人欧美日韩在线电影| 美女视频黄 久久| 丝袜亚洲另类丝袜在线| 亚洲欧美日韩国产成人精品影院 | 91原创在线视频| 成人激情校园春色| 粉嫩aⅴ一区二区三区四区| 玖玖九九国产精品| 久久国产生活片100| 日韩成人dvd| 免费在线观看精品| 日韩电影在线观看一区| 午夜电影网一区| 亚洲成人三级小说| 午夜伊人狠狠久久| 日本美女一区二区| 蜜臀av性久久久久av蜜臀妖精| 天堂资源在线中文精品| 婷婷综合另类小说色区| 亚洲午夜av在线| 午夜一区二区三区视频| 日日骚欧美日韩| 日韩精品国产精品| 久久精品国产色蜜蜜麻豆| 久久99久久99| 国产精品一区二区无线| 成人做爰69片免费看网站| 成人的网站免费观看| 本田岬高潮一区二区三区| 色一情一乱一乱一91av| 欧美在线制服丝袜| 欧美一区永久视频免费观看| 欧美一级欧美三级| 26uuu另类欧美亚洲曰本| 国产亚洲欧美在线| 日韩美女久久久| 五月婷婷综合在线| 国内外成人在线视频| aaa欧美色吧激情视频| 在线精品视频小说1| 日韩午夜精品电影| 国产欧美在线观看一区| 一区二区在线观看视频在线观看| 天天影视涩香欲综合网| 韩国v欧美v日本v亚洲v| 91免费精品国自产拍在线不卡| 欧美区一区二区三区| 精品美女在线播放| 亚洲色图欧洲色图| 日韩av电影一区| 99久久综合国产精品| 欧美日韩国产综合久久| 精品久久久久一区二区国产| 亚洲欧洲日韩av| 美国av一区二区| 97久久精品人人澡人人爽| 91麻豆精品国产自产在线| 国产欧美精品一区二区色综合朱莉| 亚洲欧洲在线观看av| 日韩精品乱码免费| 91女厕偷拍女厕偷拍高清| 日韩精品中午字幕| 一区二区国产视频| 国产精品影视天天线| 欧美日韩国产首页在线观看| 国产亚洲一二三区| 青青草精品视频| 一本久久精品一区二区| 精品成人a区在线观看| 天天操天天色综合| 日本道免费精品一区二区三区| 久久午夜电影网| 日本亚洲一区二区| 91成人在线观看喷潮| 日本一二三四高清不卡| 热久久一区二区| 欧美伊人久久大香线蕉综合69 | 99久久婷婷国产综合精品| 91精品国产综合久久婷婷香蕉| 中文字幕成人av| 国产在线不卡一区| 在线播放视频一区| 一区二区久久久久| 91丨九色porny丨蝌蚪| 亚洲国产经典视频| 国产尤物一区二区在线| 欧美一区二区精品久久911| 一区二区三区四区av| 99久久精品国产网站| 国产性做久久久久久| 国产剧情av麻豆香蕉精品| 日韩精品一区二区三区视频| 日韩激情一区二区| 欧美日韩中文一区| 午夜伦欧美伦电影理论片| 欧美视频一区二区三区四区| 最新欧美精品一区二区三区| 丁香六月久久综合狠狠色| 久久亚洲影视婷婷| 国产一区二区在线观看免费 | 亚洲欧洲99久久| 99久久精品免费看国产| 亚洲视频资源在线| 色综合久久综合中文综合网| 亚洲欧美色图小说| 欧美性猛交xxxx黑人交|