home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-05-03 | 1.6 KB | 51 lines |
- /*
- * @(#)Canvas.java 1.5 95/08/17 Sami Shaio
- *
- * Copyright (c) 1995 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for NON-COMMERCIAL purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- */
- package java.awt;
-
- import java.awt.peer.CanvasPeer;
-
- /**
- * A Canvas component. This is a generic component which
- * needs to be subclassed in order to add some interesting
- * functionality.
- *
- * @version 1.5 17 Aug 1995
- * @author Sami Shaio
- */
- public class Canvas extends Component {
-
- /**
- * Creates the peer of the canvas. This peer allows you to change the
- * user interface of the canvas without changing its functionality.
- */
- public synchronized void addNotify() {
- peer = getToolkit().createCanvas(this);
- super.addNotify();
- }
-
- /**
- * Paints the canvas in the default background color.
- * @param g the specified Graphics window
- */
- public void paint(Graphics g) {
- g.setColor(getBackground());
- g.fillRect(0, 0, width, height);
- }
- }
-