package game;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JPanel;

import com.sun.glass.events.KeyEvent;

public class Screen extends JPanel {
  static final int WIDTH = 800;
  static final int HEIGHT = 600;

  private Paddle paddle;

  private static Ball ball;

  private Brick brick;

  public Screen() {
    setPreferredSize(new Dimension(WIDTH, HEIGHT));
    setBackground(Color.BLACK);
    paddle = new Paddle();
    ball = new Ball(paddle);
    brick = new Brick(20, 230);
  }

  private void draw(Graphics g) {
    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    paddle.draw(g2d);
    ball.draw(g2d);
    brick.draw(g2d);
  }

  public void tick(boolean[] keys) {
    paddle.tick(keys[KeyEvent.VK_LEFT], keys[KeyEvent.VK_RIGHT], keys[KeyEvent.VK_SPACE]);
    ball.tick();
    ball.checkHit(brick);
  }

  public void render() {
    repaint();
  }

  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    draw(g);
  }

  public static void releaseBall() {
    ball.release();
  }
}

@@ -143,16 +143,44 @@
 ngHints;
+%0Aimport java.util.ArrayList;
 %0A%0Aimport
@@ -412,19 +412,31 @@
 ate 
+ArrayList%3C
 Brick
+%3E
  brick
+s
 ;%0A%0A 
@@ -607,30 +607,120 @@
 rick
+s
  = new 
-Brick(20, 230);
+ArrayList%3CBrick%3E();%0A    for(int i = 0; i %3C 9; i++) %7B%0A      bricks.add(new Brick(40 + i * 80, 40));%0A    %7D
 %0A  %7D
@@ -941,21 +941,47 @@
 d);%0A    
-brick
+for(Brick b : bricks) %7B%0A      b
 .draw(g2
@@ -984,16 +984,22 @@
 w(g2d);%0A
+    %7D%0A
   %7D%0A%0A  p
@@ -1136,24 +1136,54 @@
 all.tick();%0A
+    for(Brick b : bricks) %7B%0A  
     ball.che
@@ -1193,14 +1193,16 @@
 it(b
-rick);
+);%0A    %7D
 %0A  %7D

Add line of bricks