📄 html.java
字号:
/** * The value attribute */ public static final Attribute VALUE = new Attribute("value"); /** * The valuetype attribute */ public static final Attribute VALUETYPE = new Attribute("valuetype"); /** * The version attribute */ public static final Attribute VERSION = new Attribute("version"); /** * The vlink attribute */ public static final Attribute VLINK = new Attribute("vlink"); /** * The vspace attribute */ public static final Attribute VSPACE = new Attribute("vspace"); /** * The width attribute */ public static final Attribute WIDTH = new Attribute("width"); private final String name; /** * Creates the attribute with the given name. */ protected Attribute(String a_name) { name = a_name; } /** * Calls compareTo on the tag names (Strings) */ public int compareTo(Object other) { return name.compareTo(((Attribute) other).name); } /** * The attributes are equal if the names are equal * (ignoring case) */ public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Attribute)) return false; Attribute that = (Attribute) other; return that.name.equalsIgnoreCase(name); } /** * Returns the hash code which corresponds to the string for this tag. */ public int hashCode() { return name == null ? 0 : name.hashCode(); } /** * Returns the attribute name. The names of the built-in attributes * are always returned in lowercase. */ public String toString() { return name; } /** * Return an array of all attributes, declared in the HTML.Attribute * class. WARNING: attributes are the only public fields, * expected in this class. */ static Attribute[] getAllAttributes() { Field[] f = Attribute.class.getFields(); Attribute[] attrs = new Attribute[ f.length ]; Field x; int p = 0; Attribute a; for (int i = 0; i < f.length; i++) { x = f [ i ]; if ((x.getModifiers() & Modifier.STATIC) != 0) { if (x.getType().equals(Attribute.class)) { try { a = (Attribute) x.get(null); attrs [ p++ ] = a; } catch (Exception ex) { ex.printStackTrace(System.err); throw new Error("This should never happen, report a bug"); } } } } return attrs; } } /** * Represents a HTML tag. */ public static class Tag implements Comparable, Serializable { /** * The <a> tag */ public static final Tag A = new Tag("a"); /** * The <address> tag */ public static final Tag ADDRESS = new Tag("address"); /** * The <applet> tag */ public static final Tag APPLET = new Tag("applet"); /** * The <area> tag */ public static final Tag AREA = new Tag("area"); /** * The <b> tag */ public static final Tag B = new Tag("b"); /** * The <base> tag */ public static final Tag BASE = new Tag("base"); /** * The <basefont> tag */ public static final Tag BASEFONT = new Tag("basefont"); /** * The <big> tag */ public static final Tag BIG = new Tag("big"); /** * The <blockquote> tag , breaks flow, block tag. */ public static final Tag BLOCKQUOTE = new Tag("blockquote", BREAKS | BLOCK); /** * The <body> tag , breaks flow, block tag. */ public static final Tag BODY = new Tag("body", BREAKS | BLOCK); /** * The <br> tag , breaks flow. */ public static final Tag BR = new Tag("br", BREAKS); /** * The <caption> tag */ public static final Tag CAPTION = new Tag("caption"); /** * The <center> tag , breaks flow. */ public static final Tag CENTER = new Tag("center", BREAKS); /** * The <cite> tag */ public static final Tag CITE = new Tag("cite"); /** * The <code> tag */ public static final Tag CODE = new Tag("code"); /** * The <dd> tag , breaks flow, block tag. */ public static final Tag DD = new Tag("dd", BREAKS | BLOCK); /** * The <dfn> tag */ public static final Tag DFN = new Tag("dfn"); /** * The <dir> tag , breaks flow, block tag. */ public static final Tag DIR = new Tag("dir", BREAKS | BLOCK); /** * The <div> tag , breaks flow, block tag. */ public static final Tag DIV = new Tag("div", BREAKS | BLOCK); /** * The <dl> tag , breaks flow, block tag. */ public static final Tag DL = new Tag("dl", BREAKS | BLOCK); /** * The <dt> tag , breaks flow, block tag. */ public static final Tag DT = new Tag("dt", BREAKS | BLOCK); /** * The <em> tag */ public static final Tag EM = new Tag("em"); /** * The <font> tag */ public static final Tag FONT = new Tag("font"); /** * The <form> tag , breaks flow. */ public static final Tag FORM = new Tag("form", BREAKS); /** * The <frame> tag */ public static final Tag FRAME = new Tag("frame"); /** * The <frameset> tag */ public static final Tag FRAMESET = new Tag("frameset"); /** * The <h1> tag , breaks flow, block tag. */ public static final Tag H1 = new Tag("h1", BREAKS | BLOCK); /** * The <h2> tag , breaks flow, block tag. */ public static final Tag H2 = new Tag("h2", BREAKS | BLOCK); /** * The <h3> tag , breaks flow, block tag. */ public static final Tag H3 = new Tag("h3", BREAKS | BLOCK); /** * The <h4> tag , breaks flow, block tag. */ public static final Tag H4 = new Tag("h4", BREAKS | BLOCK); /** * The <h5> tag , breaks flow, block tag. */ public static final Tag H5 = new Tag("h5", BREAKS | BLOCK); /** * The <h6> tag , breaks flow, block tag. */ public static final Tag H6 = new Tag("h6", BREAKS | BLOCK); /** * The <head> tag , breaks flow, block tag. */ public static final Tag HEAD = new Tag("head", BREAKS | BLOCK); /** * The <hr> tag , breaks flow. */ public static final Tag HR = new Tag("hr", BREAKS); /** * The <html> tag , breaks flow. */ public static final Tag HTML = new Tag("html", BREAKS); /** * The <i> tag */ public static final Tag I = new Tag("i"); /** * The <img> tag */ public static final Tag IMG = new Tag("img"); /** * The <input> tag */ public static final Tag INPUT = new Tag("input"); /** * The <isindex> tag , breaks flow. */ public static final Tag ISINDEX = new Tag("isindex", BREAKS); /** * The <kbd> tag */ public static final Tag KBD = new Tag("kbd"); /** * The <li> tag , breaks flow, block tag. */ public static final Tag LI = new Tag("li", BREAKS | BLOCK); /** * The <link> tag */ public static final Tag LINK = new Tag("link"); /** * The <map> tag */ public static final Tag MAP = new Tag("map"); /** * The <menu> tag , breaks flow, block tag. */ public static final Tag MENU = new Tag("menu", BREAKS | BLOCK); /** * The <meta> tag */ public static final Tag META = new Tag("meta"); /** * The <nobr> tag */ public static final Tag NOBR = new Tag("nobr"); /** * The <noframes> tag , breaks flow, block tag. */ public static final Tag NOFRAMES = new Tag("noframes", BREAKS | BLOCK); /** * The <object> tag */ public static final Tag OBJECT = new Tag("object"); /** * The <ol> tag , breaks flow, block tag. */ public static final Tag OL = new Tag("ol", BREAKS | BLOCK); /** * The <option> tag */ public static final Tag OPTION = new Tag("option"); /** * The <p> tag , breaks flow, block tag. */ public static final Tag P = new Tag("p", BREAKS | BLOCK); /** * The <param> tag */ public static final Tag PARAM = new Tag("param"); /** * The <pre> tag , breaks flow, block tag, preformatted. */ public static final Tag PRE = new Tag("pre", BREAKS | BLOCK | PREFORMATTED); /** * The <s> tag */ public static final Tag S = new Tag("s"); /** * The <samp> tag */ public static final Tag SAMP = new Tag("samp"); /** * The <script> tag */ public static final Tag SCRIPT = new Tag("script"); /** * The <select> tag */ public static final Tag SELECT = new Tag("select"); /** * The <small> tag */ public static final Tag SMALL = new Tag("small"); /** * The <span> tag */ public static final Tag SPAN = new Tag("span"); /** * The <strike> tag */ public static final Tag STRIKE = new Tag("strike"); /** * The <strong> tag */ public static final Tag STRONG = new Tag("strong"); /** * The <style> tag */ public static final Tag STYLE = new Tag("style"); /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -