rectangle.html
来自「API資料大全」· HTML 代码 · 共 1,466 行 · 第 1/5 页
HTML
1,466 行
(<i>x</i>, <i>y</i>) is inside this <code>Rectangle</code>; <code>false</code> otherwise.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="contains(int, int)"><!-- --></A><H3>contains</H3><PRE>public boolean <B>contains</B>(int x, int y)</PRE><DL><DD>Checks whether or not this <code>Rectangle</code> contains the point at the specified location (<i>x</i>, <i>y</i>).<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x, y</CODE> - the specified coordinates<DT><B>Returns:</B><DD><code>true</code> if the point (<i>x</i>, <i>y</i>) is inside this <code>Rectangle</code>; <code>false</code> otherwise.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="contains(java.awt.Rectangle)"><!-- --></A><H3>contains</H3><PRE>public boolean <B>contains</B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A> r)</PRE><DL><DD>Checks whether or not this <code>Rectangle</code> entirely contains the specified <code>Rectangle</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>r</CODE> - the specified <code>Rectangle</code><DT><B>Returns:</B><DD><code>true</code> if the <code>Rectangle</code> is contained entirely inside this <code>Rectangle</code>; <code>false</code> otherwise.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="contains(int, int, int, int)"><!-- --></A><H3>contains</H3><PRE>public boolean <B>contains</B>(int X, int Y, int W, int H)</PRE><DL><DD>Checks whether this <code>Rectangle</code> entirely contains the <code>Rectangle</code> at the specified location (<i>X</i>, <i>Y</i>) with the specified dimensions (<i>W</i>, <i>H</i>).<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x, y</CODE> - the specified coordinates<DD><CODE>W</CODE> - the width of the <code>Rectangle</code><DD><CODE>H</CODE> - the height of the <code>Rectangle</code><DT><B>Returns:</B><DD><code>true</code> if the <code>Rectangle</code> specified by (<i>X</i>, <i>Y</i>, <i>W</i>, <i>H</i>) is entirely enclosed inside this <code>Rectangle</code>; <code>false</code> otherwise.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="inside(int, int)"><!-- --></A><H3>inside</H3><PRE>public boolean <B>inside</B>(int x, int y)</PRE><DL><DD><B>Deprecated.</B> <I>As of JDK version 1.1, replaced by <code>contains(int, int)</code>.</I><P><DD><DL></DL></DD></DL><HR><A NAME="intersects(java.awt.Rectangle)"><!-- --></A><H3>intersects</H3><PRE>public boolean <B>intersects</B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A> r)</PRE><DL><DD>Determines whether or not this <code>Rectangle</code> and the specified <code>Rectangle</code> intersect. Two rectangles intersect if their intersection is nonempty.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>r</CODE> - the specified <code>Rectangle</code><DT><B>Returns:</B><DD><code>true</code> if the specified <code>Rectangle</code> and this <code>Rectangle</code> insersect; <code>false</code> otherwise.</DL></DD></DL><HR><A NAME="intersection(java.awt.Rectangle)"><!-- --></A><H3>intersection</H3><PRE>public <A HREF="../../java/awt/Rectangle.html">Rectangle</A> <B>intersection</B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A> r)</PRE><DL><DD>Computes the intersection of this <code>Rectangle</code> with the specified <code>Rectangle</code>. Returns a new <code>Rectangle</code> that represents the intersection of the two rectangles.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>r</CODE> - the specified <code>Rectangle</code><DT><B>Returns:</B><DD>the largest <code>Rectangle</code> contained in both the specified <code>Rectangle</code> and in this<code>Rectangle</code>.</DL></DD></DL><HR><A NAME="union(java.awt.Rectangle)"><!-- --></A><H3>union</H3><PRE>public <A HREF="../../java/awt/Rectangle.html">Rectangle</A> <B>union</B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A> r)</PRE><DL><DD>Computes the union of this <code>Rectangle</code> with the specified <code>Rectangle</code>. Returns a new <code>Rectangle</code> that represents the union of the two rectangles<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>r</CODE> - the specified <code>Rectangle</code><DT><B>Returns:</B><DD>the smallest <code>Rectangle</code> containing both the specified <code>Rectangle</code> and this <code>Rectangle</code>.</DL></DD></DL><HR><A NAME="add(int, int)"><!-- --></A><H3>add</H3><PRE>public void <B>add</B>(int newx, int newy)</PRE><DL><DD>Adds a point, specified by the integer arguments <code>newx</code> and <code>newy</code>, to this <code>Rectangle</code>. The resulting <code>Rectangle</code> is the smallest <code>Rectangle</code> that contains both the original <code>Rectangle</code> and the specified point. <p> After adding a point, a call to <code>contains</code> with the added point as an argument does not necessarily return <code>true</code>. The <code>contains</code> method does not return <code>true</code> for points on the right or bottom edges of a <code>Rectangle</code>. Therefore, if the added point falls on the right or bottom edge of the enlarged <code>Rectangle</code>, <code>contains</code> returns <code>false</code> for that point.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>newx, newy</CODE> - the coordinates of the new point</DL></DD></DL><HR><A NAME="add(java.awt.Point)"><!-- --></A><H3>add</H3><PRE>public void <B>add</B>(<A HREF="../../java/awt/Point.html">Point</A> pt)</PRE><DL><DD>Adds the specified <code>Point</code> to this <code>Rectangle</code>. The resulting <code>Rectangle</code> is the smallest <code>Rectangle</code> that contains both the original <code>Rectangle</code> and the specified <code>Point</code>. <p> After adding a <code>Point</code>, a call to <code>contains</code> with the added <code>Point</code> as an argument does not necessarily return <code>true</code>. The <code>contains</code> method does not return <code>true</code> for points on the right or bottom edges of a <code>Rectangle</code>. Therefore if the added <code>Point</code> falls on the right or bottom edge of the enlarged <code>Rectangle</code>, <code>contains</code> returns <code>false</code> for that <code>Point</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pt</CODE> - the new <code>Point</code> to add to this <code>Rectangle</code></DL></DD></DL><HR><A NAME="add(java.awt.Rectangle)"><!-- --></A><H3>add</H3><PRE>public void <B>add</B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A> r)</PRE><DL><DD>Adds a <code>Rectangle</code> to this <code>Rectangle</code>. The resulting <code>Rectangle</code> is the union of the two rectangles.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>r</CODE> - the specified <code>Rectangle</code></DL></DD></DL><HR><A NAME="grow(int, int)"><!-- --></A><H3>grow</H3><PRE>public void <B>grow</B>(int h, int v)</PRE><DL><DD>Resizes the <code>Rectangle</code> both horizontally and vertically. <p> This method modifies the <code>Rectangle</code> so that it is <code>h</code> units larger on both the left and right side, and <code>v</code> units larger at both the top and bottom. <p> The new <code>Rectangle</code> has (<code>x - h</code>, <code>y - v</code>) as its top-left corner, a width of <code>width</code> <code>+</code> <code>2h</code>, and a height of <code>height</code> <code>+</code> <code>2v</code>. <p> If negative values are supplied for <code>h</code> and <code>v</code>, the size of the <code>Rectangle</code> decreases accordingly. The <code>grow</code> method does not check whether the resulting values of <code>width</code> and <code>height</code> are non-negative.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>h</CODE> - the horizontal expansion<DD><CODE>v</CODE> - the vertical expansion</DL></DD></DL><HR><A NAME="isEmpty()"><!-- --></A><H3>isEmpty</H3><PRE>public boolean <B>isEmpty</B>()</PRE><DL><DD>Determines whether or not this <code>Rectangle</code> is empty. A <code>Rectangle</code> is empty if its width or its height is less than or equal to zero.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/geom/RectangularShape.html#isEmpty()">isEmpty</A></CODE> in class <CODE><A HREF="../../java/awt/geom/RectangularShape.html">RectangularShape</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if this <code>Rectangle</code> is empty; <code>false</code> otherwise.</DL></DD></DL><HR><A NAME="outcode(double, double)"><!-- --></A><H3>outcode</H3><PRE>public int <B>outcode</B>(double x, double y)</PRE><DL><DD>Determines where the specified coordinates lie with respect to this <code>Rectangle</code>. This method computes a binary OR of the appropriate mask values indicating, for each side of this <code>Rectangle</code>, whether or not the specified coordinates are on the same side of the edge as the rest of this <code>Rectangle</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/geom/Rectangle2D.html#outcode(double, double)">outcode</A></CODE> in class <CODE><A HREF="../../java/awt/geom/Rectangle2D.html">Rectangle2D</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x, y</CODE> - the specified coordinates<DT><B>Returns:</B><DD>the logical OR of all appropriate out codes.<DT><B>Since: </B><DD>1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/geom/Rectangle2D.html#OUT_LEFT"><CODE>Rectangle2D.OUT_LEFT</CODE></A>, <A HREF="../../java/awt/geom/Rectangle2D.html#OUT_TOP"><CODE>Rectangle2D.OUT_TOP</CODE></A>, <A HREF="../../java/awt/geom/Rectangle2D.html#OUT_RIGHT"><CODE>Rectangle2D.OUT_RIGHT</CODE></A>, <A HREF="../../java/awt/geom/Rectangle2D.html#OUT_BOTTOM"><CODE>Rectangle2D.OUT_BOTTOM</CODE></A></DL></DD></DL><HR><A NAME="createIntersection(java.awt.geom.Rectangle2D)"><!-- --></A><H3>createIntersection</H3><PRE>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?