⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 html.java

📁 Mobile 应用程序使用 Java Micro Edition (Java ME) 平台
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
         * @return the string representation of this attribute         */	public String toString() {	    return name;	}	private String name;	public static final Attribute SIZE = new Attribute("size");	public static final Attribute COLOR = new Attribute("color");	public static final Attribute CLEAR = new Attribute("clear");	public static final Attribute BACKGROUND = new Attribute("background");	public static final Attribute BGCOLOR = new Attribute("bgcolor");	public static final Attribute TEXT = new Attribute("text");	public static final Attribute LINK = new Attribute("link");	public static final Attribute VLINK = new Attribute("vlink");	public static final Attribute ALINK = new Attribute("alink");	public static final Attribute WIDTH = new Attribute("width");	public static final Attribute HEIGHT = new Attribute("height");	public static final Attribute ALIGN = new Attribute("align");	public static final Attribute NAME = new Attribute("name");	public static final Attribute HREF = new Attribute("href");	public static final Attribute REL = new Attribute("rel");	public static final Attribute REV = new Attribute("rev");	public static final Attribute TITLE = new Attribute("title");	public static final Attribute TARGET = new Attribute("target");	public static final Attribute SHAPE = new Attribute("shape");	public static final Attribute COORDS = new Attribute("coords");	public static final Attribute ISMAP = new Attribute("ismap");	public static final Attribute NOHREF = new Attribute("nohref");	public static final Attribute ALT = new Attribute("alt");	public static final Attribute ID = new Attribute("id");	public static final Attribute SRC = new Attribute("src");	public static final Attribute HSPACE = new Attribute("hspace");	public static final Attribute VSPACE = new Attribute("vspace");	public static final Attribute USEMAP = new Attribute("usemap");	public static final Attribute LOWSRC = new Attribute("lowsrc");	public static final Attribute CODEBASE = new Attribute("codebase");	public static final Attribute CODE = new Attribute("code");	public static final Attribute ARCHIVE = new Attribute("archive");	public static final Attribute VALUE = new Attribute("value");	public static final Attribute VALUETYPE = new Attribute("valuetype");	public static final Attribute TYPE = new Attribute("type");	public static final Attribute CLASS = new Attribute("class");	public static final Attribute STYLE = new Attribute("style");	public static final Attribute LANG = new Attribute("lang");	public static final Attribute FACE = new Attribute("face");	public static final Attribute DIR = new Attribute("dir");	public static final Attribute DECLARE = new Attribute("declare");	public static final Attribute CLASSID = new Attribute("classid");	public static final Attribute DATA = new Attribute("data");	public static final Attribute CODETYPE = new Attribute("codetype");	public static final Attribute STANDBY = new Attribute("standby");	public static final Attribute BORDER = new Attribute("border");	public static final Attribute SHAPES = new Attribute("shapes");	public static final Attribute NOSHADE = new Attribute("noshade");	public static final Attribute COMPACT = new Attribute("compact");	public static final Attribute START = new Attribute("start");	public static final Attribute ACTION = new Attribute("action");	public static final Attribute METHOD = new Attribute("method");	public static final Attribute ENCTYPE = new Attribute("enctype");	public static final Attribute CHECKED = new Attribute("checked");	public static final Attribute MAXLENGTH = new Attribute("maxlength");	public static final Attribute MULTIPLE = new Attribute("multiple");	public static final Attribute SELECTED = new Attribute("selected");	public static final Attribute ROWS = new Attribute("rows");	public static final Attribute COLS = new Attribute("cols");	public static final Attribute DUMMY = new Attribute("dummy");	public static final Attribute CELLSPACING = new Attribute("cellspacing");	public static final Attribute CELLPADDING = new Attribute("cellpadding");	public static final Attribute VALIGN = new Attribute("valign");	public static final Attribute HALIGN = new Attribute("halign");	public static final Attribute NOWRAP = new Attribute("nowrap");	public static final Attribute ROWSPAN = new Attribute("rowspan");	public static final Attribute COLSPAN = new Attribute("colspan");	public static final Attribute PROMPT = new Attribute("prompt");	public static final Attribute HTTPEQUIV = new Attribute("http-equiv");	public static final Attribute CONTENT = new Attribute("content");	public static final Attribute LANGUAGE = new Attribute("language");	public static final Attribute VERSION = new Attribute("version");	public static final Attribute N = new Attribute("n");	public static final Attribute FRAMEBORDER = new Attribute("frameborder");	public static final Attribute MARGINWIDTH = new Attribute("marginwidth");	public static final Attribute MARGINHEIGHT = new Attribute("marginheight");	public static final Attribute SCROLLING = new Attribute("scrolling");	public static final Attribute NORESIZE = new Attribute("noresize");	public static final Attribute ENDTAG = new Attribute("endtag");	public static final Attribute COMMENT = new Attribute("comment");	static final Attribute MEDIA = new Attribute("media");	static final Attribute allAttributes[] = {	    FACE,	    COMMENT,	    SIZE,	    COLOR,	    CLEAR,	    BACKGROUND,	    BGCOLOR,	    TEXT,	    LINK,	    VLINK,	    ALINK,	    WIDTH,	    HEIGHT,	    ALIGN,	    NAME,	    HREF,            REL,            REV,            TITLE,            TARGET,            SHAPE,            COORDS,            ISMAP,            NOHREF,            ALT,            ID,            SRC,            HSPACE,            VSPACE,            USEMAP,            LOWSRC,            CODEBASE,            CODE,            ARCHIVE,            VALUE,            VALUETYPE,            TYPE,            CLASS,            STYLE,            LANG,            DIR,            DECLARE,            CLASSID,            DATA,            CODETYPE,            STANDBY,            BORDER,            SHAPES,            NOSHADE,            COMPACT,            START,            ACTION,            METHOD,            ENCTYPE,            CHECKED,            MAXLENGTH,            MULTIPLE,            SELECTED,            ROWS,            COLS,            DUMMY,            CELLSPACING,            CELLPADDING,            VALIGN,            HALIGN,            NOWRAP,            ROWSPAN,            COLSPAN,            PROMPT,            HTTPEQUIV,            CONTENT,            LANGUAGE,            VERSION,            N,            FRAMEBORDER,            MARGINWIDTH,            MARGINHEIGHT,            SCROLLING,            NORESIZE,            MEDIA,	    ENDTAG	};    }    // The secret to 73, is that, given that the Hashtable contents    // never change once the static initialization happens, the initial size     // that the hashtable grew to was determined, and then that very size    // is used.    //    private static final Hashtable tagHashtable = new Hashtable(73);    /** Maps from StyleConstant key to HTML.Tag. */    private static final Hashtable scMapping = new Hashtable(8);    static {	for (int i = 0; i < Tag.allTags.length; i++ ) {	    tagHashtable.put(Tag.allTags[i].toString(), Tag.allTags[i]);	    StyleContext.registerStaticAttributeKey(Tag.allTags[i]);	}	StyleContext.registerStaticAttributeKey(Tag.IMPLIED);	StyleContext.registerStaticAttributeKey(Tag.CONTENT);	StyleContext.registerStaticAttributeKey(Tag.COMMENT);	for (int i = 0; i < Attribute.allAttributes.length; i++) {	    StyleContext.registerStaticAttributeKey(Attribute.						    allAttributes[i]);	}	StyleContext.registerStaticAttributeKey(HTML.NULL_ATTRIBUTE_VALUE);        scMapping.put(StyleConstants.Bold, Tag.B);        scMapping.put(StyleConstants.Italic, Tag.I);        scMapping.put(StyleConstants.Underline, Tag.U);        scMapping.put(StyleConstants.StrikeThrough, Tag.STRIKE);        scMapping.put(StyleConstants.Superscript, Tag.SUP);        scMapping.put(StyleConstants.Subscript, Tag.SUB);        scMapping.put(StyleConstants.FontFamily, Tag.FONT);        scMapping.put(StyleConstants.FontSize, Tag.FONT);    }    /**     * Returns the set of actual HTML tags that     * are recognized by the default HTML reader.     * This set does not include tags that are     * manufactured by the reader.     */    public static Tag[] getAllTags() {	Tag[] tags = new Tag[Tag.allTags.length];	System.arraycopy(Tag.allTags, 0, tags, 0, Tag.allTags.length);	return tags;    }    /**     * Fetches a tag constant for a well-known tag name (i.e. one of     * the tags in the set {A, ADDRESS, APPLET, AREA, B,     * BASE, BASEFONT, BIG,     * BLOCKQUOTE, BODY, BR, CAPTION, CENTER, CITE, CODE,     * DD, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, FRAME,     * FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML,     * I, IMG, INPUT, ISINDEX, KBD, LI, LINK, MAP, MENU,     * META, NOBR, NOFRAMES, OBJECT, OL, OPTION, P, PARAM,     * PRE, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, S,     * STRONG, STYLE, SUB, SUP, TABLE, TD, TEXTAREA,     * TH, TITLE, TR, TT, U, UL, VAR}.  If the given     * name does not represent one of the well-known tags, then     * <code>null</code> will be returned.     *     * @param tagName the <code>String</code> name requested     * @return a tag constant corresponding to the <code>tagName</code>,     *    or <code>null</code> if not found     */    public static Tag getTag(String tagName) {	Object t =  tagHashtable.get(tagName);	return (t == null ? null : (Tag)t);    }    /**     * Returns the HTML <code>Tag</code> associated with the     * <code>StyleConstants</code> key <code>sc</code>.     * If no matching <code>Tag</code> is found, returns     * <code>null</code>.     *     * @param sc the <code>StyleConstants</code> key     * @return tag which corresponds to <code>sc</code>, or     *   <code>null</code> if not found     */    static Tag getTagForStyleConstantsKey(StyleConstants sc) {        return (Tag)scMapping.get(sc);    }    /**     * Fetches an integer attribute value.  Attribute values     * are stored as a string, and this is a convenience method     * to convert to an actual integer.     *     * @param attr the set of attributes to use to try to fetch a value     * @param key the key to use to fetch the value     * @param def the default value to use if the attribute isn't     *  defined or there is an error converting to an integer     */    public static int getIntegerAttributeValue(AttributeSet attr,					       Attribute key, int def) {	int value = def;	String istr = (String) attr.getAttribute(key);	if (istr != null) {	    try {		value = Integer.valueOf(istr).intValue();	    } catch (NumberFormatException e) {		value = def;	    }	}	return value;    }    //  This is used in cases where the value for the attribute has not    //  been specified.    //    public static final String NULL_ATTRIBUTE_VALUE = "#DEFAULT";    // size determined similar to size of tagHashtable    private static final Hashtable attHashtable = new Hashtable(77);    static {	for (int i = 0; i < Attribute.allAttributes.length; i++ ) {	    attHashtable.put(Attribute.allAttributes[i].toString(), Attribute.allAttributes[i]);	}    }    /**     * Returns the set of HTML attributes recognized.     * @return the set of HTML attributes recognized     */    public static Attribute[] getAllAttributeKeys() {	Attribute[] attributes = new Attribute[Attribute.allAttributes.length];	System.arraycopy(Attribute.allAttributes, 0, 			 attributes, 0, Attribute.allAttributes.length);	return attributes;    }    /**     * Fetches an attribute constant for a well-known attribute name     * (i.e. one of the attributes in the set {FACE, COMMENT, SIZE,     * COLOR, CLEAR, BACKGROUND, BGCOLOR, TEXT, LINK, VLINK, ALINK,     * WIDTH, HEIGHT, ALIGN, NAME, HREF, REL, REV, TITLE, TARGET,     * SHAPE, COORDS, ISMAP, NOHREF, ALT, ID, SRC, HSPACE, VSPACE,     * USEMAP, LOWSRC, CODEBASE, CODE, ARCHIVE, VALUE, VALUETYPE,     * TYPE, CLASS, STYLE, LANG, DIR, DECLARE, CLASSID, DATA, CODETYPE,     * STANDBY, BORDER, SHAPES, NOSHADE, COMPACT, START, ACTION, METHOD,     * ENCTYPE, CHECKED, MAXLENGTH, MULTIPLE, SELECTED, ROWS, COLS,     * DUMMY, CELLSPACING, CELLPADDING, VALIGN, HALIGN, NOWRAP, ROWSPAN,     * COLSPAN, PROMPT, HTTPEQUIV, CONTENT, LANGUAGE, VERSION, N,     * FRAMEBORDER, MARGINWIDTH, MARGINHEIGHT, SCROLLING, NORESIZE,     * MEDIA, ENDTAG}).     * If the given name does not represent one of the well-known attributes,     * then <code>null</code> will be returned.     *     * @param attName the <code>String</code> requested     * @return the <code>Attribute</code> corresponding to <code>attName</code>     */    public static Attribute getAttributeKey(String attName) {	Object a = attHashtable.get(attName);	if (a == null) {	  return null;	}	return (Attribute)a;    }}

⌨️ 快捷键说明

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