Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

help

By: a guest on Jan 12th, 2013  |  syntax: None  |  size: 1.49 KB  |  hits: 36  |  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. import java.awt.*;
  2. import java.awt.event.*;
  3. import javax.swing.*;
  4. import java.util.Random;
  5.  
  6. // Class definition
  7. public class TEMPLATE extends JPanel implements ActionListener {
  8.     private Font newFont = new Font("sansserif", Font.BOLD, 20);
  9.     private Graphics bufferGraphics;
  10.     private Image offscreen;
  11.     public static final int
  12.         WIDTH = 800,
  13.         HEIGHT = 600;
  14.        
  15.     private boolean gameOver = false;
  16.     private Timer time = new Timer(15, this);
  17.     private Random rgen = new Random();
  18.  
  19.     // Constructor method declaration
  20.     public TEMPLATE() {
  21.         setBackground(Color.black);
  22.        
  23.         offscreen = createImage(WIDTH, HEIGHT);
  24.         bufferGraphics = offscreen.getGraphics();
  25.        
  26.         setFocusable(true);
  27.         requestFocus();
  28.        
  29.         makeFrame();
  30.     }
  31.  
  32. //Other Stuff...
  33.  
  34.         public void makeFrame() {
  35.  
  36.                 // Instantiate a window frame using Swing class JFrame
  37.                 JFrame frame = new JFrame("TEMPLATE");
  38.  
  39.                 // When the window is closed terminate the application
  40.                 frame.addWindowListener(new WindowAdapter() {
  41.                     public void windowClosing(WindowEvent e) {
  42.                         System.exit(0);
  43.                     }
  44.                 });
  45.  
  46.                 // set initial size of window
  47.                 frame.setSize(WIDTH, HEIGHT);
  48.  
  49.                 // add the current object to the centre of the frame and make visible
  50.                 frame.getContentPane().add(this, BorderLayout.CENTER);
  51.                 frame.setVisible(true);
  52.     }  
  53. }