📄 gapcontent.html
字号:
</TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/swing/undo/UndoableEdit.html">UndoableEdit</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/GapContent.html#remove(int, int)">remove</A></B>(int where, int nitems)</CODE><BR> Removes part of the content.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/GapContent.html#replace(int, int, java.lang.Object, int)">replace</A></B>(int position, int rmSize, <A HREF="../../../java/lang/Object.html">Object</A> addItems, int addSize)</CODE><BR> Replace the given logical position in the storage with the given new items.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/GapContent.html#resetMarksAtZero()">resetMarksAtZero</A></B>()</CODE><BR> Resets all the marks that have an offset of 0 to have an index of zero as well.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/GapContent.html#shiftEnd(int)">shiftEnd</A></B>(int newSize)</CODE><BR> Make the gap bigger, moving any necessary data and updating the appropriate marks</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/GapContent.html#shiftGap(int)">shiftGap</A></B>(int newGapStart)</CODE><BR> Move the start of the gap to a new location, without changing the size of the gap.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/GapContent.html#shiftGapEndUp(int)">shiftGapEndUp</A></B>(int newGapEnd)</CODE><BR> Adjust the gap end upward.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/GapContent.html#shiftGapStartDown(int)">shiftGapStartDown</A></B>(int newGapStart)</CODE><BR> Adjust the gap end downward.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/swing/text/GapContent.html#updateUndoPositions(java.util.Vector, int, int)">updateUndoPositions</A></B>(<A HREF="../../../java/util/Vector.html">Vector</A> positions, int offset, int length)</CODE><BR> Resets the location for all the UndoPosRef instances in <code>positions</code>.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ 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="GapContent()"><!-- --></A><H3>GapContent</H3><PRE>public <B>GapContent</B>()</PRE><DL><DD>Creates a new GapContent object. Initial size defaults to 10.</DL><HR><A NAME="GapContent(int)"><!-- --></A><H3>GapContent</H3><PRE>public <B>GapContent</B>(int initialLength)</PRE><DL><DD>Creates a new GapContent object, with the initial size specified. The initial size will not be allowed to go below 2, to give room for the implied break and the gap.<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="allocateArray(int)"><!-- --></A><H3>allocateArray</H3><PRE>protected <A HREF="../../../java/lang/Object.html">Object</A> <B>allocateArray</B>(int len)</PRE><DL><DD>Allocate an array to store items of the type appropriate (which is determined by the subclass).<DD><DL><DT><B>Overrides:</B><DD><CODE>allocateArray</CODE> in class <CODE>javax.swing.text.GapVector</CODE></DL></DD></DL><HR><A NAME="getArrayLength()"><!-- --></A><H3>getArrayLength</H3><PRE>protected int <B>getArrayLength</B>()</PRE><DL><DD>Get the length of the allocated array.<DD><DL><DT><B>Overrides:</B><DD><CODE>getArrayLength</CODE> in class <CODE>javax.swing.text.GapVector</CODE></DL></DD></DL><HR><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.<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, where + nitems < length()<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.<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<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. If the desired content spans the gap, we copy the content. If the desired content does not span the gap, the actual store is returned to avoid the copy since it is contiguous.<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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -