|
|
|
@@ -0,0 +1,748 @@
|
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
|
|
|
<!--NewPage-->
|
|
|
|
|
<HTML>
|
|
|
|
|
<HEAD>
|
|
|
|
|
<!-- Generated by javadoc (build 1.8.0_31) on Mon Oct 05 10:02:33 BST 2015 -->
|
|
|
|
|
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
|
|
<TITLE>
|
|
|
|
|
Canvas
|
|
|
|
|
</TITLE>
|
|
|
|
|
|
|
|
|
|
<META NAME="date" CONTENT="2015-10-05">
|
|
|
|
|
|
|
|
|
|
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
|
|
|
|
|
|
|
|
|
<SCRIPT type="text/javascript">
|
|
|
|
|
function windowTitle()
|
|
|
|
|
{
|
|
|
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
|
|
|
parent.document.title="Canvas";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</SCRIPT>
|
|
|
|
|
<NOSCRIPT>
|
|
|
|
|
</NOSCRIPT>
|
|
|
|
|
|
|
|
|
|
</HEAD>
|
|
|
|
|
|
|
|
|
|
<BODY BGCOLOR="white" onload="windowTitle();">
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<HR>
|
|
|
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
|
|
|
<H2>
|
|
|
|
|
Class Canvas</H2>
|
|
|
|
|
<PRE>
|
|
|
|
|
java.lang.Object
|
|
|
|
|
<IMG SRC="./resources/inherit.gif" ALT="extended by "><B>Canvas</B>
|
|
|
|
|
</PRE>
|
|
|
|
|
<HR>
|
|
|
|
|
<DL>
|
|
|
|
|
<DT><PRE>public class <B>Canvas</B><DT>extends java.lang.Object</DL>
|
|
|
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
Class Canvas - a class to allow for simple graphical
|
|
|
|
|
drawing on a canvas.
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
<DL>
|
|
|
|
|
<DT><B>Version:</B></DT>
|
|
|
|
|
<DD>2016.02.29</DD>
|
|
|
|
|
<DT><B>Author:</B></DT>
|
|
|
|
|
<DD>Michael Kölling (mik), Bruce Quig</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
|
|
|
|
|
|
|
|
<A NAME="constructor_summary"><!-- --></A>
|
|
|
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
|
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
|
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
|
|
|
<B>Constructor Summary</B></FONT></TH>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
|
|
|
<TD><CODE><B><A HREF="Canvas.html#Canvas(java.lang.String)">Canvas</A></B>(java.lang.String title)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Create a Canvas with default height, width and background color
|
|
|
|
|
(300, 300, white).</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
|
|
|
<TD><CODE><B><A HREF="Canvas.html#Canvas(java.lang.String, int, int)">Canvas</A></B>(java.lang.String title,
|
|
|
|
|
int width,
|
|
|
|
|
int height)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Create a Canvas with default background color (white).</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
|
|
|
<TD><CODE><B><A HREF="Canvas.html#Canvas(java.lang.String, int, int, java.awt.Color)">Canvas</A></B>(java.lang.String title,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
java.awt.Color bgColor)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Create a Canvas.</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
|
|
|
|
|
|
|
|
<A NAME="method_summary"><!-- --></A>
|
|
|
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
|
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
|
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
|
|
|
<B>Method Summary</B></FONT></TH>
|
|
|
|
|
</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="Canvas.html#draw(java.awt.Shape)">draw</A></B>(java.awt.Shape shape)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Draw the outline of a given shape onto the canvas.</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="Canvas.html#drawImage(java.awt.Image, int, int)">drawImage</A></B>(java.awt.Image image,
|
|
|
|
|
int x,
|
|
|
|
|
int y)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Draws an image onto the canvas.</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="Canvas.html#drawLine(int, int, int, int)">drawLine</A></B>(int x1,
|
|
|
|
|
int y1,
|
|
|
|
|
int x2,
|
|
|
|
|
int y2)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Draws a line on the Canvas.</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="Canvas.html#drawString(java.lang.String, int, int)">drawString</A></B>(java.lang.String text,
|
|
|
|
|
int x,
|
|
|
|
|
int y)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Draws a String on the Canvas.</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="Canvas.html#erase()">erase</A></B>()</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Erase the whole canvas.</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="Canvas.html#erase(java.awt.Shape)">erase</A></B>(java.awt.Shape shape)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Erase a given shape's interior on the screen.</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="Canvas.html#eraseCircle(int, int, int)">eraseCircle</A></B>(int xPos,
|
|
|
|
|
int yPos,
|
|
|
|
|
int diameter)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Erase the internal dimensions of the given circle.</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="Canvas.html#eraseOutline(java.awt.Shape)">eraseOutline</A></B>(java.awt.Shape shape)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Erases a given shape's outline on the screen.</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="Canvas.html#eraseRectangle(int, int, int, int)">eraseRectangle</A></B>(int xPos,
|
|
|
|
|
int yPos,
|
|
|
|
|
int width,
|
|
|
|
|
int height)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Erase the internal dimensions of the given rectangle.</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="Canvas.html#eraseString(java.lang.String, int, int)">eraseString</A></B>(java.lang.String text,
|
|
|
|
|
int x,
|
|
|
|
|
int y)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Erases a String on the Canvas.</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="Canvas.html#fill(java.awt.Shape)">fill</A></B>(java.awt.Shape shape)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Fill the internal dimensions of a given shape with the current
|
|
|
|
|
foreground color of the canvas.</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="Canvas.html#fillCircle(int, int, int)">fillCircle</A></B>(int xPos,
|
|
|
|
|
int yPos,
|
|
|
|
|
int diameter)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Fill the internal dimensions of the given circle with the current
|
|
|
|
|
foreground color of the canvas.</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="Canvas.html#fillRectangle(int, int, int, int)">fillRectangle</A></B>(int xPos,
|
|
|
|
|
int yPos,
|
|
|
|
|
int width,
|
|
|
|
|
int height)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Fill the internal dimensions of the given rectangle with the current
|
|
|
|
|
foreground color of the canvas.</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
|
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
|
|
|
<CODE> java.awt.Color</CODE></FONT></TD>
|
|
|
|
|
<TD><CODE><B><A HREF="Canvas.html#getBackgroundColor()">getBackgroundColor</A></B>()</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Returns the current color of the background</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
|
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
|
|
|
<CODE> java.awt.Font</CODE></FONT></TD>
|
|
|
|
|
<TD><CODE><B><A HREF="Canvas.html#getFont()">getFont</A></B>()</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Returns the current font of the canvas.</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
|
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
|
|
|
<CODE> java.awt.Color</CODE></FONT></TD>
|
|
|
|
|
<TD><CODE><B><A HREF="Canvas.html#getForegroundColor()">getForegroundColor</A></B>()</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Returns the current color of the foreground.</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
|
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
|
|
|
<CODE> java.awt.Dimension</CODE></FONT></TD>
|
|
|
|
|
<TD><CODE><B><A HREF="Canvas.html#getSize()">getSize</A></B>()</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Returns the size of the canvas.</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="Canvas.html#isVisible()">isVisible</A></B>()</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Provide information on visibility of the Canvas.</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="Canvas.html#setBackgroundColor(java.awt.Color)">setBackgroundColor</A></B>(java.awt.Color newColor)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Sets the background color of the Canvas.</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="Canvas.html#setFont(java.awt.Font)">setFont</A></B>(java.awt.Font newFont)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
changes the current Font used on the Canvas</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="Canvas.html#setForegroundColor(java.awt.Color)">setForegroundColor</A></B>(java.awt.Color newColor)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Sets the foreground color of the Canvas.</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="Canvas.html#setSize(int, int)">setSize</A></B>(int width,
|
|
|
|
|
int height)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Sets the size of the canvas.</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="Canvas.html#setVisible(boolean)">setVisible</A></B>(boolean visible)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Set the canvas visibility and brings canvas to the front of screen
|
|
|
|
|
when made visible.</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="Canvas.html#wait(int)">wait</A></B>(int milliseconds)</CODE>
|
|
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
|
Waits for a specified number of milliseconds before finishing.</TD>
|
|
|
|
|
</TR>
|
|
|
|
|
</TABLE>
|
|
|
|
|
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
|
|
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
|
|
|
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
|
|
|
|
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
|
|
|
|
|
</TR>
|
|
|
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
|
|
|
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
|
|
|
|
|
</TR>
|
|
|
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
|
|
|
|
|
|
|
|
<A NAME="constructor_detail"><!-- --></A>
|
|
|
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
|
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
|
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
|
|
|
<B>Constructor Detail</B></FONT></TH>
|
|
|
|
|
</TR>
|
|
|
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
<A NAME="Canvas(java.lang.String)"><!-- --></A><H3>
|
|
|
|
|
Canvas</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public <B>Canvas</B>(java.lang.String title)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Create a Canvas with default height, width and background color
|
|
|
|
|
(300, 300, white).
|
|
|
|
|
<P>
|
|
|
|
|
<DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>title</CODE> - title to appear in Canvas Frame</DL>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="Canvas(java.lang.String, int, int)"><!-- --></A><H3>
|
|
|
|
|
Canvas</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public <B>Canvas</B>(java.lang.String title,
|
|
|
|
|
int width,
|
|
|
|
|
int height)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Create a Canvas with default background color (white).
|
|
|
|
|
<P>
|
|
|
|
|
<DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>title</CODE> - title to appear in Canvas Frame<DD><CODE>width</CODE> - the desired width for the canvas<DD><CODE>height</CODE> - the desired height for the canvas</DL>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="Canvas(java.lang.String, int, int, java.awt.Color)"><!-- --></A><H3>
|
|
|
|
|
Canvas</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public <B>Canvas</B>(java.lang.String title,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
java.awt.Color bgColor)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Create a Canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>title</CODE> - title to appear in Canvas Frame<DD><CODE>width</CODE> - the desired width for the canvas<DD><CODE>height</CODE> - the desired height for the canvas<DD><CODE>bgClour</CODE> - the desired background color of the canvas</DL>
|
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
|
|
|
|
|
|
|
|
<A NAME="method_detail"><!-- --></A>
|
|
|
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
|
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
|
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
|
|
|
<B>Method Detail</B></FONT></TH>
|
|
|
|
|
</TR>
|
|
|
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
<A NAME="draw(java.awt.Shape)"><!-- --></A><H3>
|
|
|
|
|
draw</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>draw</B>(java.awt.Shape shape)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Draw the outline of a given shape onto the canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>shape</CODE> - the shape object to be drawn on the canvas</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="drawImage(java.awt.Image, int, int)"><!-- --></A><H3>
|
|
|
|
|
drawImage</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public boolean <B>drawImage</B>(java.awt.Image image,
|
|
|
|
|
int x,
|
|
|
|
|
int y)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Draws an image onto the canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>image</CODE> - the Image object to be displayed<DD><CODE>x</CODE> - x co-ordinate for Image placement<DD><CODE>y</CODE> - y co-ordinate for Image placement
|
|
|
|
|
<DT><B>Returns:</B><DD>returns boolean value representing whether the image was
|
|
|
|
|
completely loaded</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="drawLine(int, int, int, int)"><!-- --></A><H3>
|
|
|
|
|
drawLine</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>drawLine</B>(int x1,
|
|
|
|
|
int y1,
|
|
|
|
|
int x2,
|
|
|
|
|
int y2)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Draws a line on the Canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>x1</CODE> - x co-ordinate of start of line<DD><CODE>y1</CODE> - y co-ordinate of start of line<DD><CODE>x2</CODE> - x co-ordinate of end of line<DD><CODE>y2</CODE> - y co-ordinate of end of line</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="drawString(java.lang.String, int, int)"><!-- --></A><H3>
|
|
|
|
|
drawString</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>drawString</B>(java.lang.String text,
|
|
|
|
|
int x,
|
|
|
|
|
int y)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Draws a String on the Canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>text</CODE> - the String to be displayed<DD><CODE>x</CODE> - x co-ordinate for text placement<DD><CODE>y</CODE> - y co-ordinate for text placement</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="erase()"><!-- --></A><H3>
|
|
|
|
|
erase</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>erase</B>()</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Erase the whole canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="erase(java.awt.Shape)"><!-- --></A><H3>
|
|
|
|
|
erase</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>erase</B>(java.awt.Shape shape)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Erase a given shape's interior on the screen.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>shape</CODE> - the shape object to be erased</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="eraseCircle(int, int, int)"><!-- --></A><H3>
|
|
|
|
|
eraseCircle</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>eraseCircle</B>(int xPos,
|
|
|
|
|
int yPos,
|
|
|
|
|
int diameter)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Erase the internal dimensions of the given circle. This is a
|
|
|
|
|
convenience method. A similar effect can be achieved with
|
|
|
|
|
the "erase" method.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="eraseOutline(java.awt.Shape)"><!-- --></A><H3>
|
|
|
|
|
eraseOutline</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>eraseOutline</B>(java.awt.Shape shape)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Erases a given shape's outline on the screen.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>shape</CODE> - the shape object to be erased</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="eraseRectangle(int, int, int, int)"><!-- --></A><H3>
|
|
|
|
|
eraseRectangle</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>eraseRectangle</B>(int xPos,
|
|
|
|
|
int yPos,
|
|
|
|
|
int width,
|
|
|
|
|
int height)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Erase the internal dimensions of the given rectangle. This is a
|
|
|
|
|
convenience method. A similar effect can be achieved with
|
|
|
|
|
the "erase" method.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="eraseString(java.lang.String, int, int)"><!-- --></A><H3>
|
|
|
|
|
eraseString</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>eraseString</B>(java.lang.String text,
|
|
|
|
|
int x,
|
|
|
|
|
int y)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Erases a String on the Canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>text</CODE> - the String to be displayed<DD><CODE>x</CODE> - x co-ordinate for text placement<DD><CODE>y</CODE> - y co-ordinate for text placement</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="fill(java.awt.Shape)"><!-- --></A><H3>
|
|
|
|
|
fill</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>fill</B>(java.awt.Shape shape)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Fill the internal dimensions of a given shape with the current
|
|
|
|
|
foreground color of the canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>shape</CODE> - the shape object to be filled</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="fillCircle(int, int, int)"><!-- --></A><H3>
|
|
|
|
|
fillCircle</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>fillCircle</B>(int xPos,
|
|
|
|
|
int yPos,
|
|
|
|
|
int diameter)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Fill the internal dimensions of the given circle with the current
|
|
|
|
|
foreground color of the canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>xPos</CODE> - The x-coordinate of the circle center point<DD><CODE>yPos</CODE> - The y-coordinate of the circle center point<DD><CODE>diameter</CODE> - The diameter of the circle to be drawn</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="fillRectangle(int, int, int, int)"><!-- --></A><H3>
|
|
|
|
|
fillRectangle</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>fillRectangle</B>(int xPos,
|
|
|
|
|
int yPos,
|
|
|
|
|
int width,
|
|
|
|
|
int height)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Fill the internal dimensions of the given rectangle with the current
|
|
|
|
|
foreground color of the canvas. This is a convenience method. A similar
|
|
|
|
|
effect can be achieved with the "fill" method.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="getBackgroundColor()"><!-- --></A><H3>
|
|
|
|
|
getBackgroundColor</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public java.awt.Color <B>getBackgroundColor</B>()</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Returns the current color of the background
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
|
|
|
|
|
<DT><B>Returns:</B><DD>the color of the background of the Canvas</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="getFont()"><!-- --></A><H3>
|
|
|
|
|
getFont</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public java.awt.Font <B>getFont</B>()</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Returns the current font of the canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
|
|
|
|
|
<DT><B>Returns:</B><DD>the font currently in use</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="getForegroundColor()"><!-- --></A><H3>
|
|
|
|
|
getForegroundColor</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public java.awt.Color <B>getForegroundColor</B>()</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Returns the current color of the foreground.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
|
|
|
|
|
<DT><B>Returns:</B><DD>the color of the foreground of the Canvas</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="getSize()"><!-- --></A><H3>
|
|
|
|
|
getSize</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public java.awt.Dimension <B>getSize</B>()</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Returns the size of the canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
|
|
|
|
|
<DT><B>Returns:</B><DD>The current dimension of the canvas</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="isVisible()"><!-- --></A><H3>
|
|
|
|
|
isVisible</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public boolean <B>isVisible</B>()</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Provide information on visibility of the Canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
|
|
|
|
|
<DT><B>Returns:</B><DD>true if canvas is visible, false otherwise</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="setBackgroundColor(java.awt.Color)"><!-- --></A><H3>
|
|
|
|
|
setBackgroundColor</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>setBackgroundColor</B>(java.awt.Color newColor)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Sets the background color of the Canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>newColor</CODE> - the new color for the background of the Canvas</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="setFont(java.awt.Font)"><!-- --></A><H3>
|
|
|
|
|
setFont</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>setFont</B>(java.awt.Font newFont)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>changes the current Font used on the Canvas
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>newFont</CODE> - new font to be used for String output</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="setForegroundColor(java.awt.Color)"><!-- --></A><H3>
|
|
|
|
|
setForegroundColor</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>setForegroundColor</B>(java.awt.Color newColor)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Sets the foreground color of the Canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>newColor</CODE> - the new color for the foreground of the Canvas</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="setSize(int, int)"><!-- --></A><H3>
|
|
|
|
|
setSize</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>setSize</B>(int width,
|
|
|
|
|
int height)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Sets the size of the canvas.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>width</CODE> - new width<DD><CODE>height</CODE> - new height</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="setVisible(boolean)"><!-- --></A><H3>
|
|
|
|
|
setVisible</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>setVisible</B>(boolean visible)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Set the canvas visibility and brings canvas to the front of screen
|
|
|
|
|
when made visible. This method can also be used to bring an already
|
|
|
|
|
visible canvas to the front of other windows.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>visible</CODE> - boolean value representing the desired visibility of
|
|
|
|
|
the canvas (true or false)</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<A NAME="wait(int)"><!-- --></A><H3>
|
|
|
|
|
wait</H3>
|
|
|
|
|
<PRE>
|
|
|
|
|
public void <B>wait</B>(int milliseconds)</PRE>
|
|
|
|
|
<DL>
|
|
|
|
|
<DD>Waits for a specified number of milliseconds before finishing.
|
|
|
|
|
This provides an easy way to specify a small delay which can be
|
|
|
|
|
used when producing animations.
|
|
|
|
|
<P>
|
|
|
|
|
<DD><DL>
|
|
|
|
|
<DT><B>Parameters:</B><DD><CODE>milliseconds</CODE> - the number</DL>
|
|
|
|
|
</DD>
|
|
|
|
|
</DL>
|
|
|
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
|
|
</BODY>
|
|
|
|
|
</HTML>
|