Logo
Distributed Genetic Programming Framework
print print

File org.sfc.gui.Canvas.java

Here you can find all the information about the file org.sfc.gui.Canvas.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Thomas Weise
 * 
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2006-02-08 05:22:50
 * Original Filename: org.sfc.gui.Canvas.java
 * Version          : 1.0.1
 * Last modification: 2006-03-07
 *                by: Thomas Weise
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */

 
package org.sfc.gui;

import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JComponent;

/**
 * The class canvas represents a simple surface to draw on.
 *
 * @author Thomas Weise
 */

public class Canvas extends JComponent
  {
/**
 * The serial version uid.
 */

  private static  final long  serialVersionUID = 0;
    
/**
 * Create a new canvas.
 */

  public  Canvas  ()
    {
    super();
    }
  
/**
 * The paint routine is called whenever the canvas should be drawn on the
 * screen.
 * @param p_g The graphics context to paint on.
 */

  @Override
  public  final void  paint (final  Graphics p_g)
    {
    final Graphics2D  l_g2d;
    final int         l_w, l_h;
    
    l_g2d = ((Graphics2D)p_g);
    l_w   = this.getWidth();
    l_h   = this.getHeight();
  
    p_g.setColor(this.getBackground());
    p_g.fillRect(0, 0, l_w, l_h);
    
    this.paint(l_g2d, l_w, l_h);
    }
  
/**
 * This method is the preferred way to paint the canvas.
 * @param p_g       The graphics context to paint on. 
 * @param p_width   The canvas' width.
 * @param p_height  The canvas' height.
 */

  protected void  paint (final Graphics2D p_g,
                         final int        p_width,
                         final int        p_height)
    {
    //
    }
  }

File Information:

file name:Canvas.java
package:org.sfc.gui
qualified name:org.sfc.gui.Canvas.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/sfc/gui/Canvas.java
size:2.387 KB (2445 B)
uploaded: 2018-01-07 12:03:36 GMT+0000
last update: 2006-03-07 04:20:35 GMT+0000
last access: 2018-04-21 04:10:53 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2018-01-07 12:03:34 GMT+0000 served at 2018-04-21 04:10:53 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo