graphics.html
来自「API資料大全」· HTML 代码 · 共 1,336 行 · 第 1/5 页
HTML
1,336 行
<!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:37 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class Graphics</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/Graphics.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/GradientPaint.html"><B>PREV CLASS</B></A> <A HREF="../../java/awt/Graphics2D.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="Graphics.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><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.awt</FONT><BR>Class Graphics</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<B>java.awt.Graphics</B></PRE><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../javax/swing/DebugGraphics.html">DebugGraphics</A>, <A HREF="../../java/awt/Graphics2D.html">Graphics2D</A></DD></DL><HR><DL><DT>public abstract class <B>Graphics</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A></DL><P>The <code>Graphics</code> class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images. <p> A <code>Graphics</code> object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties: <p> <ul> <li>The <code>Component</code> object on which to draw. <li>A translation origin for rendering and clipping coordinates. <li>The current clip. <li>The current color. <li>The current font. <li>The current logical pixel operation function (XOR or Paint). <li>The current XOR alternation color (see <A HREF="../../java/awt/Graphics.html#setXORMode(java.awt.Color)"><CODE>setXORMode(java.awt.Color)</CODE></A>). </ul> <p> Coordinates are infinitely thin and lie between the pixels of the output device. Operations that draw the outline of a figure operate by traversing an infinitely thin path between pixels with a pixel-sized pen that hangs down and to the right of the anchor point on the path. Operations that fill a figure operate by filling the interior of that infinitely thin path. Operations that render horizontal text render the ascending portion of character glyphs entirely above the baseline coordinate. <p> The graphics pen hangs down and to the right from the path it traverses. This has the following implications: <p><ul> <li>If you draw a figure that covers a given rectangle, that figure occupies one extra row of pixels on the right and bottom edges as compared to filling a figure that is bounded by that same rectangle. <li>If you draw a horizontal line along the same <i>y</i> coordinate as the baseline of a line of text, that line is drawn entirely below the text, except for any descenders. </ul><p> All coordinates that appear as arguments to the methods of this <code>Graphics</code> object are considered relative to the translation origin of this <code>Graphics</code> object prior to the invocation of the method. <p> All rendering operations modify only pixels which lie within the area bounded by the current clip, which is specified by a <A HREF="../../java/awt/Shape.html"><CODE>Shape</CODE></A> in user space and is controlled by the program using the <code>Graphics</code> object. This <i>user clip</i> is transformed into device space and combined with the <i>device clip</i>, which is defined by the visibility of windows and device extents. The combination of the user clip and device clip defines the <i>composite clip</i>, which determines the final clipping region. The user clip cannot be modified by the rendering system to reflect the resulting composite clip. The user clip can only be changed through the <code>setClip</code> or <code>clipRect</code> methods. All drawing or writing is done in the current color, using the current paint mode, and in the current font.<P><DL><DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/Component.html"><CODE>Component</CODE></A>, <A HREF="../../java/awt/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setColor(java.awt.Color)"><CODE>setColor(java.awt.Color)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setPaintMode()"><CODE>setPaintMode()</CODE></A>, <A HREF="../../java/awt/Graphics.html#setXORMode(java.awt.Color)"><CODE>setXORMode(java.awt.Color)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setFont(java.awt.Font)"><CODE>setFont(java.awt.Font)</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== 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 ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected </CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#Graphics()">Graphics</A></B>()</CODE><BR> Constructs a new <code>Graphics</code> object.</TD></TR></TABLE> <!-- ========== 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>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#clearRect(int, int, int, int)">clearRect</A></B>(int x, int y, int width, int height)</CODE><BR> Clears the specified rectangle by filling it with the background color of the current drawing surface.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#clipRect(int, int, int, int)">clipRect</A></B>(int x, int y, int width, int height)</CODE><BR> Intersects the current clip with the specified rectangle.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#copyArea(int, int, int, int, int, int)">copyArea</A></B>(int x, int y, int width, int height, int dx, int dy)</CODE><BR> Copies an area of the component by a distance specified by <code>dx</code> and <code>dy</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../java/awt/Graphics.html">Graphics</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#create()">create</A></B>()</CODE><BR> Creates a new <code>Graphics</code> object that is a copy of this <code>Graphics</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/awt/Graphics.html">Graphics</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#create(int, int, int, int)">create</A></B>(int x, int y, int width, int height)</CODE><BR> Creates a new <code>Graphics</code> object based on this <code>Graphics</code> object, but with a new translation and clip area.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#dispose()">dispose</A></B>()</CODE><BR> Disposes of this graphics context and releases any system resources that it is using.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#draw3DRect(int, int, int, int, boolean)">draw3DRect</A></B>(int x, int y, int width, int height, boolean raised)</CODE><BR> Draws a 3-D highlighted outline of the specified rectangle.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/awt/Graphics.html#drawArc(int, int, int, int, int, int)">drawArc</A></B>(int x, int y, int width, int height, int startAngle, int arcAngle)</CODE><BR> Draws the outline of a circular or elliptical arc covering the specified rectangle.</TD>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?