SHARE
TWEET

Game java part 1

Mary_99 Apr 20th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import javax.swing.*;
  2. import java.awt.*;
  3.  
  4.  
  5. //@SuppressWornings("serial")
  6.  
  7. public class Ball extends JFrame{
  8.  
  9.  
  10.  
  11.  
  12.     final int MAX_BALL = 3;
  13.     final int SQUERE_WIDTH = 9;
  14.     final int SQUERE_HIGHT = 9;
  15.     final int BALL_SIZE = 32;
  16.  
  17.     final int PANEL_WIDTH = SQUERE_WIDTH * BALL_SIZE ;
  18.  
  19.     final Color BACKGROUNG_COLOUR = new Color(225, 141, 198);
  20.     final Color SQUERE_COLOUR = new Color(171, 225, 224);
  21.  
  22.     public Ball(JPanel panel) throws HeadlessException {
  23.         this.panel = panel;
  24.     }
  25.  
  26.     final Color [] BALL_COLOUR =
  27.             {
  28.                     Color.RED,Color.BLUE,Color.GREEN,Color.CYAN,Color.ORANGE
  29.             };
  30.     JPanel panel;
  31.     JLabel lpoints;
  32.     JButton bStart;
  33.     GameArea gameArea;
  34.  
  35.  
  36.  
  37.     public Ball()
  38.     {
  39.         super("Ball");
  40.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  41.  
  42.         panel = new JPanel();
  43.         gameArea = new GameArea();
  44.         panel.setLayout(null);
  45.         panel.setBackground(BACKGROUNG_COLOUR);
  46.  
  47.         gameArea.setBounds(10, 10, 300, 300);
  48.         gameArea.setBackroumnd(SQUERE_COLOUR);
  49.  
  50.         panel.add(gameArea);
  51.  
  52.         add(panel);
  53.  
  54.         setSize(400,4000);
  55.         setLocationRelativeTo(null);
  56.         setResizable(false);
  57.         setVisible(true);
  58.     }
  59.  
  60.     public static void main (String[] args) {new Ball();}
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top