Advertisement
Jnk1296

Pong Recreation - Class Pong (Main Class)

Feb 28th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. package net.jnk.pongTEST;
  2.  
  3. import java.awt.*;
  4.  
  5. import javax.swing.JFrame;
  6.  
  7. public class Pong extends Canvas{
  8.    
  9.     private static final String TITLE = "Pong v1.0";
  10.    
  11.     public static final int WIN_DIM_X = 800;
  12.     public static final int WIN_DIM_Y = 600;
  13.     public static final Dimension SIZE = new Dimension(WIN_DIM_X, WIN_DIM_Y);
  14.    
  15.     private static final long serialVersionUID = 1L;
  16.  
  17.     public static void main(String[] args) {
  18.         initialize();
  19.     }
  20.    
  21.     public static void initialize() {
  22.         JFrame frame = new JFrame();
  23.        
  24.         //Instantiates Elements Class and triggers it's paint method.
  25.         Elements e = new Elements();
  26.        
  27.         frame.setTitle(TITLE);
  28.         frame.setPreferredSize(SIZE);
  29.         frame.setResizable(false);
  30.         frame.add(e);
  31.         frame.addMouseMotionListener(new Input());
  32.         frame.pack();
  33.        
  34.         frame.setLocationRelativeTo(null);
  35.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  36.         frame.setVisible(true);
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement