Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- //@SuppressWornings("serial")
- public class Ball extends JFrame{
- final int MAX_BALL = 3;
- final int SQUERE_WIDTH = 9;
- final int SQUERE_HIGHT = 9;
- final int BALL_SIZE = 32;
- final int PANEL_WIDTH = SQUERE_WIDTH * BALL_SIZE ;
- final Color BACKGROUNG_COLOUR = new Color(225, 141, 198);
- final Color SQUERE_COLOUR = new Color(171, 225, 224);
- public Ball(JPanel panel) throws HeadlessException {
- this.panel = panel;
- }
- final Color [] BALL_COLOUR =
- {
- Color.RED,Color.BLUE,Color.GREEN,Color.CYAN,Color.ORANGE
- };
- JPanel panel;
- JLabel lpoints;
- JButton bStart;
- GameArea gameArea;
- public Ball()
- {
- super("Ball");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- panel = new JPanel();
- gameArea = new GameArea();
- panel.setLayout(null);
- panel.setBackground(BACKGROUNG_COLOUR);
- gameArea.setBounds(10, 10, 300, 300);
- gameArea.setBackroumnd(SQUERE_COLOUR);
- panel.add(gameArea);
- add(panel);
- setSize(400,4000);
- setLocationRelativeTo(null);
- setResizable(false);
- setVisible(true);
- }
- public static void main (String[] args) {new Ball();}
- }
Advertisement
Add Comment
Please, Sign In to add comment