📄 stringcontent.html
字号:
<!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="StringContent()"><!-- --></A><H3>StringContent</H3><PRE>public <B>StringContent</B>()</PRE><DL><DD>Creates a new StringContent object. Initial size defaults to 10.</DL><HR><A NAME="StringContent(int)"><!-- --></A><H3>StringContent</H3><PRE>public <B>StringContent</B>(int initialLength)</PRE><DL><DD>Creates a new StringContent object, with the initial size specified. If the length is < 1, a size of 1 is used.<DD><DL><DT><B>Parameters:</B><DD><CODE>initialLength</CODE> - the initial size</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="length()"><!-- --></A><H3>length</H3><PRE>public int <B>length</B>()</PRE><DL><DD>Returns the length of the content.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#length()">length</A></CODE> in interface <CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html">AbstractDocument.Content</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the length >= 1<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#length()"><CODE>AbstractDocument.Content.length()</CODE></A></DL></DD></DL><HR><A NAME="insertString(int, java.lang.String)"><!-- --></A><H3>insertString</H3><PRE>public <A HREF="../../../javax/swing/undo/UndoableEdit.html">UndoableEdit</A> <B>insertString</B>(int where, <A HREF="../../../java/lang/String.html">String</A> str) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Inserts a string into the content.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#insertString(int, java.lang.String)">insertString</A></CODE> in interface <CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html">AbstractDocument.Content</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>where</CODE> - the starting position >= 0 && < length()<DD><CODE>str</CODE> - the non-null string to insert<DT><B>Returns:</B><DD>an UndoableEdit object for undoing<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if the specified position is invalid<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#insertString(int, java.lang.String)"><CODE>AbstractDocument.Content.insertString(int, java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="remove(int, int)"><!-- --></A><H3>remove</H3><PRE>public <A HREF="../../../javax/swing/undo/UndoableEdit.html">UndoableEdit</A> <B>remove</B>(int where, int nitems) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Removes part of the content. where + nitems must be < length().<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#remove(int, int)">remove</A></CODE> in interface <CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html">AbstractDocument.Content</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>where</CODE> - the starting position >= 0<DD><CODE>nitems</CODE> - the number of characters to remove >= 0<DT><B>Returns:</B><DD>an UndoableEdit object for undoing<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if the specified position is invalid<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#remove(int, int)"><CODE>AbstractDocument.Content.remove(int, int)</CODE></A></DL></DD></DL><HR><A NAME="getString(int, int)"><!-- --></A><H3>getString</H3><PRE>public <A HREF="../../../java/lang/String.html">String</A> <B>getString</B>(int where, int len) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Retrieves a portion of the content. where + len must be <= length().<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#getString(int, int)">getString</A></CODE> in interface <CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html">AbstractDocument.Content</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>where</CODE> - the starting position >= 0<DD><CODE>len</CODE> - the length to retrieve >= 0<DT><B>Returns:</B><DD>a string representing the content; may be empty<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if the specified position is invalid<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#getString(int, int)"><CODE>AbstractDocument.Content.getString(int, int)</CODE></A></DL></DD></DL><HR><A NAME="getChars(int, int, javax.swing.text.Segment)"><!-- --></A><H3>getChars</H3><PRE>public void <B>getChars</B>(int where, int len, <A HREF="../../../javax/swing/text/Segment.html">Segment</A> chars) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Retrieves a portion of the content. where + len must be <= length()<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#getChars(int, int, javax.swing.text.Segment)">getChars</A></CODE> in interface <CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html">AbstractDocument.Content</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>where</CODE> - the starting position >= 0<DD><CODE>len</CODE> - the number of characters to retrieve >= 0<DD><CODE>chars</CODE> - the Segment object to return the characters in<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if the specified position is invalid<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#getChars(int, int, javax.swing.text.Segment)"><CODE>AbstractDocument.Content.getChars(int, int, javax.swing.text.Segment)</CODE></A></DL></DD></DL><HR><A NAME="createPosition(int)"><!-- --></A><H3>createPosition</H3><PRE>public <A HREF="../../../javax/swing/text/Position.html">Position</A> <B>createPosition</B>(int offset) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Creates a position within the content that will track change as the content is mutated.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html#createPosition(int)">createPosition</A></CODE> in interface <CODE><A HREF="../../../javax/swing/text/AbstractDocument.Content.html">AbstractDocument.Content</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>offset</CODE> - the offset to create a position for >= 0<DT><B>Returns:</B><DD>the position<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if the specified position is invalid</DL></DD></DL><HR><A NAME="getPositionsInRange(java.util.Vector, int, int)"><!-- --></A><H3>getPositionsInRange</H3><PRE>protected <A HREF="../../../java/util/Vector.html">Vector</A> <B>getPositionsInRange</B>(<A HREF="../../../java/util/Vector.html">Vector</A> v, int offset, int length)</PRE><DL><DD>Returns a Vector containing instances of UndoPosRef for the Positions in the range <code>offset</code> to <code>offset</code> + <code>length</code>. If <code>v</code> is not null the matching Positions are placed in there. The vector with the resulting Positions are returned.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>v</CODE> - the Vector to use, with a new one created on null<DD><CODE>offset</CODE> - the starting offset >= 0<DD><CODE>length</CODE> - the length >= 0<DT><B>Returns:</B><DD>the set of instances</DL></DD></DL><HR><A NAME="updateUndoPositions(java.util.Vector)"><!-- --></A><H3>updateUndoPositions</H3><PRE>protected void <B>updateUndoPositions</B>(<A HREF="../../../java/util/Vector.html">Vector</A> positions)</PRE><DL><DD>Resets the location for all the UndoPosRef instances in <code>positions</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>positions</CODE> - the positions of the instances</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/StringContent.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/SimpleAttributeSet.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/swing/text/StyleConstants.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="StringContent.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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 + -