texthitinfo.html
来自「API資料大全」· HTML 代码 · 共 505 行 · 第 1/2 页
HTML
505 行
<!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:33:35 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class TextHitInfo</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/TextHitInfo.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="../../../java/awt/font/TextAttribute.html"><B>PREV CLASS</B></A> <A HREF="../../../java/awt/font/TextLayout.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="TextHitInfo.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">java.awt.font</FONT><BR>Class TextHitInfo</H2><PRE><A HREF="../../../java/lang/Object.html">java.lang.Object</A> | +--<B>java.awt.font.TextHitInfo</B></PRE><HR><DL><DT>public final class <B>TextHitInfo</B><DT>extends <A HREF="../../../java/lang/Object.html">Object</A></DL><P>The <code>TextHitInfo</code> class represents a character position in a text model, and a <b>bias</b>, or "side," of the character. Biases are either <EM>leading</EM> (the left edge, for a left-to-right character) or <EM>trailing</EM> (the right edge, for a left-to-right character). Instances of <code>TextHitInfo</code> are used to specify caret and insertion positions within text. <p> For example, consider the text "abc". TextHitInfo.trailing(1) corresponds to the right side of the 'b' in the text. <p> <code>TextHitInfo</code> is used primarily by <A HREF="../../../java/awt/font/TextLayout.html"><CODE>TextLayout</CODE></A> and clients of <code>TextLayout</code>. Clients of <code>TextLayout</code> query <code>TextHitInfo</code> instances for an insertion offset, where new text is inserted into the text model. The insertion offset is equal to the character position in the <code>TextHitInfo</code> if the bias is leading, and one character after if the bias is trailing. The insertion offset for TextHitInfo.trailing(1) is 2. <p> Sometimes it is convenient to construct a <code>TextHitInfo</code> with the same insertion offset as an existing one, but on the opposite character. The <code>getOtherHit</code> method constructs a new <code>TextHitInfo</code> with the same insertion offset as an existing one, with a hit on the character on the other side of the insertion offset. Calling <code>getOtherHit</code> on trailing(1) would return leading(2). In general, <code>getOtherHit</code> for trailing(n) returns leading(n+1) and <code>getOtherHit</code> for leading(n) returns trailing(n-1). <p> <strong>Example</strong>:<p> Converting a graphical point to an insertion point within a text model <blockquote><pre> TextLayout layout = ...; Point2D.Float hitPoint = ...; TextHitInfo hitInfo = layout.hitTestChar(hitPoint.x, hitPoint.y); int insPoint = hitInfo.getInsertionIndex(); // insPoint is relative to layout; may need to adjust for use // in a text model </pre></blockquote><P><DL><DT><B>See Also: </B><DD><A HREF="../../../java/awt/font/TextLayout.html"><CODE>TextLayout</CODE></A></DL><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>static <A HREF="../../../java/awt/font/TextHitInfo.html">TextHitInfo</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/font/TextHitInfo.html#afterOffset(int)">afterOffset</A></B>(int offset)</CODE><BR> Creates a <code>TextHitInfo</code> at the specified offset, associated with the character after the offset.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../java/awt/font/TextHitInfo.html">TextHitInfo</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/font/TextHitInfo.html#beforeOffset(int)">beforeOffset</A></B>(int offset)</CODE><BR> Creates a <code>TextHitInfo</code> at the specified offset, associated with the character before the offset.</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="../../../java/awt/font/TextHitInfo.html#equals(java.lang.Object)">equals</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> obj)</CODE><BR> Returns <code>true</code> if the specified <code>Object</code> is a <code>TextHitInfo</code> and equals this <code>TextHitInfo</code>.</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="../../../java/awt/font/TextHitInfo.html#equals(java.awt.font.TextHitInfo)">equals</A></B>(<A HREF="../../../java/awt/font/TextHitInfo.html">TextHitInfo</A> hitInfo)</CODE><BR> Returns <code>true</code> if the specified <code>TextHitInfo</code> has the same <code>charIndex</code> and <code>isLeadingEdge</code> as this <code>TextHitInfo</code>.</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="../../../java/awt/font/TextHitInfo.html#getCharIndex()">getCharIndex</A></B>()</CODE><BR> Returns the index of the character hit.</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="../../../java/awt/font/TextHitInfo.html#getInsertionIndex()">getInsertionIndex</A></B>()</CODE><BR> Returns the insertion index.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../java/awt/font/TextHitInfo.html">TextHitInfo</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/font/TextHitInfo.html#getOffsetHit(int)">getOffsetHit</A></B>(int delta)</CODE><BR> Creates a <code>TextHitInfo</code> whose character index is offset by <code>delta</code> from the <code>charIndex</code> of this <code>TextHitInfo</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../java/awt/font/TextHitInfo.html">TextHitInfo</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/font/TextHitInfo.html#getOtherHit()">getOtherHit</A></B>()</CODE><BR> Creates a <code>TextHitInfo</code> on the other side of the insertion point.</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="../../../java/awt/font/TextHitInfo.html#hashCode()">hashCode</A></B>()</CODE><BR> Returns the hash code.</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="../../../java/awt/font/TextHitInfo.html#isLeadingEdge()">isLeadingEdge</A></B>()</CODE><BR> Returns <code>true</code> if the leading edge of the character was hit.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../java/awt/font/TextHitInfo.html">TextHitInfo</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/font/TextHitInfo.html#leading(int)">leading</A></B>(int charIndex)</CODE><BR> Creates a <code>TextHitInfo</code> on the leading edge of the character at the specified <code>charIndex</code>.</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="../../../java/awt/font/TextHitInfo.html#toString()">toString</A></B>()</CODE><BR> Returns a <code>String</code> representing the hit for debugging use only.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../java/awt/font/TextHitInfo.html">TextHitInfo</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/font/TextHitInfo.html#trailing(int)">trailing</A></B>(int charIndex)</CODE><BR> Creates a hit on the trailing edge of the character at the specified <code>charIndex</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>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?