rectangle.html

来自「API資料大全」· HTML 代码 · 共 1,466 行 · 第 1/5 页

HTML
1,466
字号
<!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:32:57 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  Rectangle</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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Rectangle.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/awt/PrintJob.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/awt/RenderingHints.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>  &nbsp;&nbsp;<A HREF="Rectangle.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;<A HREF="#inner_classes_inherited_from_class_java.awt.geom.Rectangle2D">INNER</A>&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<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><BR>Class  Rectangle</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A>  |  +--<A HREF="../../java/awt/geom/RectangularShape.html">java.awt.geom.RectangularShape</A>        |        +--<A HREF="../../java/awt/geom/Rectangle2D.html">java.awt.geom.Rectangle2D</A>              |              +--<B>java.awt.Rectangle</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/lang/Cloneable.html">Cloneable</A>, <A HREF="../../java/io/Serializable.html">Serializable</A>, <A HREF="../../java/awt/Shape.html">Shape</A></DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../javax/swing/text/DefaultCaret.html">DefaultCaret</A></DD></DL><HR><DL><DT>public class <B>Rectangle</B><DT>extends <A HREF="../../java/awt/geom/Rectangle2D.html">Rectangle2D</A><DT>implements <A HREF="../../java/awt/Shape.html">Shape</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DL><P>A <code>Rectangle</code> specifies an area in a coordinate space that is  enclosed by the <code>Rectangle</code> object's top-left point  (<i>x</i>,&nbsp;<i>y</i>)  in the coordinate space, its width, and its height.  <p> A <code>Rectangle</code> object's <code>width</code> and <code>height</code> are <code>public</code> fields. The constructors  that create a <code>Rectangle</code>, and the methods that can modify  one, do not prevent setting a negative value for width or height.  <p> A <code>Rectangle</code> whose width or height is negative is considered  empty. If the <code>Rectangle</code> is empty, then the   <code>isEmpty</code> method returns <code>true</code>. No point can be  contained by or inside an empty <code>Rectangle</code>.  The  values of <code>width</code> and <code>height</code>, however, are still  valid.  An empty <code>Rectangle</code> still has a location in the  coordinate space, and methods that change its size or location remain  valid. The behavior of methods that operate on more than one  <code>Rectangle</code> is undefined if any of the participating  <code>Rectangle</code> objects has a negative  <code>width</code> or <code>height</code>. These methods include  <code>intersects</code>, <code>intersection</code>, and  <code>union</code>.<P><DL><DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../serialized-form.html#java.awt.Rectangle">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><A NAME="inner_classes_inherited_from_class_java.awt.geom.Rectangle2D"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Inner classes inherited from class java.awt.geom.<A HREF="../../java/awt/geom/Rectangle2D.html">Rectangle2D</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/awt/geom/Rectangle2D.Double.html">Rectangle2D.Double</A>, <A HREF="../../java/awt/geom/Rectangle2D.Float.html">Rectangle2D.Float</A></CODE></TD></TR></TABLE>&nbsp;<!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#height">height</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The height of the <code>Rectangle</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#width">width</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The width of the <code>Rectangle</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#x">x</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The <i>x</i> coordinate of the <code>Rectangle</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#y">y</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The <i>y</i> coordinate of the <code>Rectangle</code>.</TD></TR></TABLE>&nbsp;<A NAME="fields_inherited_from_class_java.awt.geom.Rectangle2D"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from class java.awt.geom.<A HREF="../../java/awt/geom/Rectangle2D.html">Rectangle2D</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/awt/geom/Rectangle2D.html#OUT_BOTTOM">OUT_BOTTOM</A>, <A HREF="../../java/awt/geom/Rectangle2D.html#OUT_LEFT">OUT_LEFT</A>, <A HREF="../../java/awt/geom/Rectangle2D.html#OUT_RIGHT">OUT_RIGHT</A>, <A HREF="../../java/awt/geom/Rectangle2D.html#OUT_TOP">OUT_TOP</A></CODE></TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#Rectangle()">Rectangle</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>Rectangle</code> whose top-left corner  is at (0,&nbsp;0) in the coordinate space, and whose width and  height are both zero.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#Rectangle(java.awt.Dimension)">Rectangle</A></B>(<A HREF="../../java/awt/Dimension.html">Dimension</A>&nbsp;d)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>Rectangle</code> whose top left corner is   (0,&nbsp;0) and whose width and height are specified   by the <code>Dimension</code> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#Rectangle(int, int)">Rectangle</A></B>(int&nbsp;width,          int&nbsp;height)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>Rectangle</code> whose top-left corner  is at (0,&nbsp;0) in the coordinate space, and whose width and  height are specified by the arguments of the same name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#Rectangle(int, int, int, int)">Rectangle</A></B>(int&nbsp;x,          int&nbsp;y,          int&nbsp;width,          int&nbsp;height)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>Rectangle</code> whose top-left corner is  specified as (<code>x</code>,&nbsp;<code>y</code>) and whose width and height  are specified by the arguments of the same name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#Rectangle(java.awt.Point)">Rectangle</A></B>(<A HREF="../../java/awt/Point.html">Point</A>&nbsp;p)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>Rectangle</code> whose top-left corner is the   specified <code>Point</code>, and whose width and height are both zero.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#Rectangle(java.awt.Point, java.awt.Dimension)">Rectangle</A></B>(<A HREF="../../java/awt/Point.html">Point</A>&nbsp;p,          <A HREF="../../java/awt/Dimension.html">Dimension</A>&nbsp;d)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>Rectangle</code> whose top-left corner is  specified by the <A HREF="../../java/awt/Point.html"><CODE>Point</CODE></A> argument, and whose width and height are specified by the  <A HREF="../../java/awt/Dimension.html"><CODE>Dimension</CODE></A> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#Rectangle(java.awt.Rectangle)">Rectangle</A></B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A>&nbsp;r)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>Rectangle</code>, initialized to match  the values of the specificed <code>Rectangle</code>.</TD></TR></TABLE>&nbsp;<!-- ========== 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>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#add(int, int)">add</A></B>(int&nbsp;newx,    int&nbsp;newy)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a point, specified by the integer arguments <code>newx</code> and <code>newy</code>, to this <code>Rectangle</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#add(java.awt.Point)">add</A></B>(<A HREF="../../java/awt/Point.html">Point</A>&nbsp;pt)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds the specified <code>Point</code> to this  <code>Rectangle</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#add(java.awt.Rectangle)">add</A></B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A>&nbsp;r)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a <code>Rectangle</code> to this <code>Rectangle</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#contains(int, int)">contains</A></B>(int&nbsp;x,         int&nbsp;y)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks whether or not this <code>Rectangle</code> contains the  point at the specified location (<i>x</i>,&nbsp;<i>y</i>).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Rectangle.html#contains(int, int, int, int)">contains</A></B>(int&nbsp;X,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?