Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.57 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package net.jam.canvas;
  2.  
  3. import java.awt.Canvas;
  4. import java.awt.Graphics;
  5. import java.awt.image.BufferedImage;
  6.  
  7. public class JammyCanvas extends Canvas {
  8.        
  9.         private static final BufferedImage gameImage = new BufferedImage(764, 503, BufferedImage.TYPE_INT_ARGB);
  10.  
  11.         @Override
  12.         public Graphics getGraphics(){
  13.                 Graphics buffer = gameImage.getGraphics();
  14.                 buffer.drawString("Jello is yellow!", 100, 100);
  15.                 super.getGraphics().drawImage(gameImage, 0, 0, null);
  16.                 return buffer;
  17.         }
  18.        
  19.         public static final BufferedImage getGameImage() {
  20.                 return gameImage;
  21.         }
  22.  
  23. }