📄 htmldocument.html
字号:
public <B>HTMLDocument</B>(<A HREF="../../../../javax/swing/text/AbstractDocument.Content.html">AbstractDocument.Content</A> c, <A HREF="../../../../javax/swing/text/html/StyleSheet.html">StyleSheet</A> styles)</PRE><DL><DD>Constructs an HTML document with the given content storage implementation and the given style/attribute storage mechanism.<DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - the container for the content<DD><CODE>styles</CODE> - the styles</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getReader(int)"><!-- --></A><H3>getReader</H3><PRE>public <A HREF="../../../../javax/swing/text/html/HTMLEditorKit.ParserCallback.html">HTMLEditorKit.ParserCallback</A> <B>getReader</B>(int pos)</PRE><DL><DD>Fetches the reader for the parser to use to load the document with HTML. This is implemented to return an instance of HTMLDocument.HTMLReader. Subclasses can reimplement this method to change how the document get structured if desired (e.g. to handle custom tags, structurally represent character style elements, etc.).</DL><HR><A NAME="getReader(int, int, int, javax.swing.text.html.HTML.Tag)"><!-- --></A><H3>getReader</H3><PRE>public <A HREF="../../../../javax/swing/text/html/HTMLEditorKit.ParserCallback.html">HTMLEditorKit.ParserCallback</A> <B>getReader</B>(int pos, int popDepth, int pushDepth, <A HREF="../../../../javax/swing/text/html/HTML.Tag.html">HTML.Tag</A> insertTag)</PRE><DL><DD>Fetches the reader for the parser to use to load the document with HTML. This is implemented to return an instance of HTMLDocument.HTMLReader. Subclasses can reimplement this method to change how the document get structured if desired (e.g. to handle custom tags, structurally represent character style elements, etc.).<DD><DL><DT><B>Parameters:</B><DD><CODE>popDepth</CODE> - the number of ElementSpec.EndTagTypes to generate before inserting<DD><CODE>pushDepth</CODE> - the number of ElementSpec.StartTagTypes with a direction of ElementSpec.JoinNextDirection that should be generated before inserting, but after the end tags have been generated<DD><CODE>insertTag</CODE> - the first tag to start inserting into document</DL></DD></DL><HR><A NAME="getBase()"><!-- --></A><H3>getBase</H3><PRE>public <A HREF="../../../../java/net/URL.html">URL</A> <B>getBase</B>()</PRE><DL><DD>Gets the location to resolve relative URLs against. By default this will be the document's URL if the document was loaded from a URL. If a base tag is found and can be parsed, it will be used as the base location.</DL><HR><A NAME="setBase(java.net.URL)"><!-- --></A><H3>setBase</H3><PRE>public void <B>setBase</B>(<A HREF="../../../../java/net/URL.html">URL</A> u)</PRE><DL><DD>Sets the location to resolve relative URLs against. By default this will be the document's URL if the document was loaded from a URL. If a base tag is found and can be parsed, it will be used as the base location. <p>This also sets the base of the StyleSheet to be <code>u</code> as well as the receiver.</DL><HR><A NAME="insert(int, javax.swing.text.DefaultStyledDocument.ElementSpec[])"><!-- --></A><H3>insert</H3><PRE>protected void <B>insert</B>(int offset, <A HREF="../../../../javax/swing/text/DefaultStyledDocument.ElementSpec.html">DefaultStyledDocument.ElementSpec</A>[] data) throws <A HREF="../../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Inserts new elements in bulk. This is how elements get created in the document. The parsing determines what structure is needed and creates the specification as a set of tokens that describe the edit while leaving the document free of a write-lock. This method can then be called in bursts by the reader to acquire a write-lock for a shorter duration (i.e. while the document is actually being altered).<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../javax/swing/text/DefaultStyledDocument.html#insert(int, javax.swing.text.DefaultStyledDocument.ElementSpec[])">insert</A></CODE> in class <CODE><A HREF="../../../../javax/swing/text/DefaultStyledDocument.html">DefaultStyledDocument</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>offset</CODE> - the starting offset<DD><CODE>data</CODE> - the element data<DT><B>Throws:</B><DD><CODE><A HREF="../../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if the given position does not represent a valid location in the associated document.</DL></DD></DL><HR><A NAME="insertUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AttributeSet)"><!-- --></A><H3>insertUpdate</H3><PRE>protected void <B>insertUpdate</B>(<A HREF="../../../../javax/swing/text/AbstractDocument.DefaultDocumentEvent.html">AbstractDocument.DefaultDocumentEvent</A> chng, <A HREF="../../../../javax/swing/text/AttributeSet.html">AttributeSet</A> attr)</PRE><DL><DD>Updates document structure as a result of text insertion. This will happen within a write lock. This implementation simply parses the inserted content for line breaks and builds up a set of instructions for the element buffer.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../javax/swing/text/DefaultStyledDocument.html#insertUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AttributeSet)">insertUpdate</A></CODE> in class <CODE><A HREF="../../../../javax/swing/text/DefaultStyledDocument.html">DefaultStyledDocument</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>chng</CODE> - a description of the document change<DD><CODE>attr</CODE> - the attributes</DL></DD></DL><HR><A NAME="create(javax.swing.text.DefaultStyledDocument.ElementSpec[])"><!-- --></A><H3>create</H3><PRE>protected void <B>create</B>(<A HREF="../../../../javax/swing/text/DefaultStyledDocument.ElementSpec.html">DefaultStyledDocument.ElementSpec</A>[] data)</PRE><DL><DD>Replaces the contents of the document with the given element specifications. This is called before insert if the loading is done in bursts. This is the only method called if loading the document entirely in one burst.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../javax/swing/text/DefaultStyledDocument.html#create(javax.swing.text.DefaultStyledDocument.ElementSpec[])">create</A></CODE> in class <CODE><A HREF="../../../../javax/swing/text/DefaultStyledDocument.html">DefaultStyledDocument</A></CODE></DL></DD></DL><HR><A NAME="setParagraphAttributes(int, int, javax.swing.text.AttributeSet, boolean)"><!-- --></A><H3>setParagraphAttributes</H3><PRE>public void <B>setParagraphAttributes</B>(int offset, int length, <A HREF="../../../../javax/swing/text/AttributeSet.html">AttributeSet</A> s, boolean replace)</PRE><DL><DD>Sets attributes for a paragraph. <p> This method is thread safe, although most Swing methods are not. Please see <A HREF="http://java.sun.com/products/jfc/swingdoc-archive/threads.html">Threads and Swing</A> for more information.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../javax/swing/text/DefaultStyledDocument.html#setParagraphAttributes(int, int, javax.swing.text.AttributeSet, boolean)">setParagraphAttributes</A></CODE> in class <CODE><A HREF="../../../../javax/swing/text/DefaultStyledDocument.html">DefaultStyledDocument</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>offset</CODE> - the offset into the paragraph (must be at least 0)<DD><CODE>length</CODE> - the number of characters affected (must be at least 0)<DD><CODE>s</CODE> - the attributes<DD><CODE>replace</CODE> - whether to replace existing attributes, or merge them</DL></DD></DL><HR><A NAME="getStyleSheet()"><!-- --></A><H3>getStyleSheet</H3><PRE>public <A HREF="../../../../javax/swing/text/html/StyleSheet.html">StyleSheet</A> <B>getStyleSheet</B>()</PRE><DL><DD>Fetches the StyleSheet with the document-specific display rules (CSS) that were specified in the HTML document itself.</DL><HR><A NAME="getIterator(javax.swing.text.html.HTML.Tag)"><!-- --></A><H3>getIterator</H3><PRE>public <A HREF="../../../../javax/swing/text/html/HTMLDocument.Iterator.html">HTMLDocument.Iterator</A> <B>getIterator</B>(<A HREF="../../../../javax/swing/text/html/HTML.Tag.html">HTML.Tag</A> t)</PRE><DL><DD>Fetches an iterator for the following kind of HTML tag. This can be used for things like iterating over the set of anchors contained, iterating over the input elements, etc.</DL><HR><A NAME="createLeafElement(javax.swing.text.Element, javax.swing.text.AttributeSet, int, int)"><!-- --></A><H3>createLeafElement</H3><PRE>protected <A HREF="../../../../javax/swing/text/Element.html">Element</A> <B>createLeafElement</B>(<A HREF="../../../../javax/swing/text/Element.html">Element</A> parent, <A HREF="../../../../javax/swing/text/AttributeSet.html">AttributeSet</A> a, int p0, int p1)</PRE><DL><DD>Creates a document leaf element that directly represents text (doesn't have any children). This is implemented to return an element of type <code>HTMLDocument.RunElement</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../javax/swing/text/AbstractDocument.html#createLeafElement(javax.swing.text.Element, javax.swing.text.AttributeSet, int, int)">createLeafElement</A></CODE> in class <CODE><A HREF="../../../../javax/swing/text/AbstractDocument.html">AbstractDocument</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parent</CODE> - the parent element<DD><CODE>a</CODE> - the attributes for the element<DD><CODE>p0</CODE> - the beginning of the range (must be at least 0)<DD><CODE>p1</CODE> - the end of the range (must be at least p0)<DT><B>Returns:</B><DD>the new element</DL></DD></DL><HR><A NAME="createBranchElement(javax.swing.text.Element, javax.swing.text.AttributeSet)"><!-- --></A><H3>createBranchElement</H3><PRE>protected <A HREF="../../../../javax/swing/text/Element.html">Element</A> <B>createBranchElement</B>(<A HREF="../../../../javax/swing/text/Element.html">Element</A> parent, <A HREF="../../../../javax/swing/text/AttributeSet.html">AttributeSet</A> a)</PRE><DL><DD>Creates a document branch element, that can contain other elements. This is implemented to return an element of type <code>HTMLDocument.BlockElement</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../javax/swing/text/AbstractDocument.html#createBranchElement(javax.swing.text.Element, javax.swing.text.AttributeSet)">createBranchElement</A></CODE> in class <CODE><A HREF="../../../../javax/swing/text/AbstractDocument.html">AbstractDocument</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parent</CODE> - the parent element<DD><CODE>a</CODE> - the attributes<DT><B>Returns:</B><DD>the element</DL></DD></DL><HR><A NAME="createDefaultRoot()"><!-- --></A><H3>createDefaultRoot</H3><PRE>protected <A HREF="../../../../javax/swing/text/AbstractDocument.AbstractElement.html">AbstractDocument.AbstractElement</A> <B>createDefaultRoot</B>()</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -