📄 element.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:41:54 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Interface Element</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Element.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/swing/text/Document.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/swing/text/Highlighter.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Element.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.swing.text</FONT><BR>Interface Element</H2><DL><DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../javax/swing/text/AbstractDocument.AbstractElement.html">AbstractDocument.AbstractElement</A></DD></DL><HR><DL><DT>public interface <B>Element</B></DL><P>Interface to describe a structural piece of a document. It is intended to capture the spirit of an SGML element.<P><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/swing/text/AttributeSet.html">AttributeSet</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getAttributes()">getAttributes</A></B>()</CODE><BR> Fetches the collection of attributes this element contains.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/swing/text/Document.html">Document</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getDocument()">getDocument</A></B>()</CODE><BR> Fetches the document associated with this element.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/swing/text/Element.html">Element</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getElement(int)">getElement</A></B>(int index)</CODE><BR> Fetches the child element at the given index.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getElementCount()">getElementCount</A></B>()</CODE><BR> Gets the number of child elements contained by this element.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getElementIndex(int)">getElementIndex</A></B>(int offset)</CODE><BR> Gets the child element index closest to the given offset.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getEndOffset()">getEndOffset</A></B>()</CODE><BR> Fetches the offset from the beginning of the document that this element ends at.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getName()">getName</A></B>()</CODE><BR> Fetches the name of the element.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/swing/text/Element.html">Element</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getParentElement()">getParentElement</A></B>()</CODE><BR> Fetches the parent element.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#getStartOffset()">getStartOffset</A></B>()</CODE><BR> Fetches the offset from the beginning of the document that this element begins at.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/Element.html#isLeaf()">isLeaf</A></B>()</CODE><BR> Is this element a leaf element?</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ 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="getDocument()"><!-- --></A><H3>getDocument</H3><PRE>public <A HREF="../../../javax/swing/text/Document.html">Document</A> <B>getDocument</B>()</PRE><DL><DD>Fetches the document associated with this element.<DD><DL><DT><B>Returns:</B><DD>the document</DL></DD></DL><HR><A NAME="getParentElement()"><!-- --></A><H3>getParentElement</H3><PRE>public <A HREF="../../../javax/swing/text/Element.html">Element</A> <B>getParentElement</B>()</PRE><DL><DD>Fetches the parent element. If the element is a root level element returns null.<DD><DL><DT><B>Returns:</B><DD>the parent element</DL></DD></DL><HR><A NAME="getName()"><!-- --></A><H3>getName</H3><PRE>public <A HREF="../../../java/lang/String.html">String</A> <B>getName</B>()</PRE><DL><DD>Fetches the name of the element. If the element is used to represent some type of structure, this would be the type name.<DD><DL><DT><B>Returns:</B><DD>the element name</DL></DD></DL><HR><A NAME="getAttributes()"><!-- --></A><H3>getAttributes</H3><PRE>public <A HREF="../../../javax/swing/text/AttributeSet.html">AttributeSet</A> <B>getAttributes</B>()</PRE><DL><DD>Fetches the collection of attributes this element contains.<DD><DL><DT><B>Returns:</B><DD>the attributes for the element</DL></DD></DL><HR><A NAME="getStartOffset()"><!-- --></A><H3>getStartOffset</H3><PRE>public int <B>getStartOffset</B>()</PRE><DL><DD>Fetches the offset from the beginning of the document that this element begins at. If this element has children, this will be the offset of the first child.<DD><DL><DT><B>Returns:</B><DD>the starting offset >= 0</DL></DD></DL><HR><A NAME="getEndOffset()"><!-- --></A><H3>getEndOffset</H3><PRE>public int <B>getEndOffset</B>()</PRE><DL><DD>Fetches the offset from the beginning of the document that this element ends at. If this element has children, this will be the end offset of the last child. <p> All the default Document implementations descend from AbstractDocument. AbstractDocument models an implied break at the end of the document. As a result of this, it is possible for this to return a value greater than the length of the document.<DD><DL><DT><B>Returns:</B><DD>the ending offset >= 0<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/AbstractDocument.html"><CODE>AbstractDocument</CODE></A></DL></DD></DL><HR><A NAME="getElementIndex(int)"><!-- --></A><H3>getElementIndex</H3><PRE>public int <B>getElementIndex</B>(int offset)</PRE><DL><DD>Gets the child element index closest to the given offset. The offset is specified relative to the begining of the document.<DD><DL><DT><B>Parameters:</B><DD><CODE>offset</CODE> - the specified offset >= 0<DT><B>Returns:</B><DD>the element index >= 0</DL></DD></DL><HR><A NAME="getElementCount()"><!-- --></A><H3>getElementCount</H3><PRE>public int <B>getElementCount</B>()</PRE><DL><DD>Gets the number of child elements contained by this element. If this element is a leaf, a count of zero is returned.<DD><DL><DT><B>Returns:</B><DD>the number of child elements >= 0</DL></DD></DL><HR><A NAME="getElement(int)"><!-- --></A><H3>getElement</H3><PRE>public <A HREF="../../../javax/swing/text/Element.html">Element</A> <B>getElement</B>(int index)</PRE><DL><DD>Fetches the child element at the given index.<DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the specified index >= 0<DT><B>Returns:</B><DD>the child element</DL></DD></DL><HR><A NAME="isLeaf()"><!-- --></A><H3>isLeaf</H3><PRE>public boolean <B>isLeaf</B>()</PRE><DL><DD>Is this element a leaf element?<DD><DL><DT><B>Returns:</B><DD>true if a leaf element else false</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Element.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/swing/text/Document.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/swing/text/Highlighter.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Element.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -