htmlstyle.java

来自「很棒的web服务器源代码」· Java 代码 · 共 65 行

JAVA
65
字号
// HtmlStyle.java// $Id: HtmlStyle.java,v 1.6 2000/08/16 21:37:40 ylafon Exp $// (c) COPYRIGHT MIT and INRIA, 1996.// Please first read the full copyright statement in file COPYRIGHT.htmlpackage org.w3c.jigsaw.html ;import org.w3c.www.mime.MimeType;/** * a sample Style class for HTML documents */public class HtmlStyle {    MimeType        type = MimeType.TEXT_CSS;    StringBuffer    style = null;    /**     * set the type of style sheet used     * @param style the sheet's MimeType.     */    public void setType(MimeType type)    {	this.type = type;    }    /**     * append a string to the style buffer     * @param str1 A string to be append     */    public void append(String str1)    {	if(style == null)	    style = new StringBuffer(str1);	else	    style.append(str1);    }    /**     * genereate a String representation that can be     * append in a HTML document     */    public String toString()    {	if(style == null)	    return "";	return "<STYLE TYPE=\"" + type.toString() + "\">\n"	       + style.toString() + "\n</STYLE>\n" ;    }    public HtmlStyle(MimeType type, String style)    {	setType(type);	append(style);    }    public HtmlStyle(String style)    {	append(style);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?