## Class View

- java.lang.Object
- - View

- All Implemented Interfaces:
    `EventListener`, `javafx.event.EventHandler<javafx.scene.input.KeyEvent>`

      public class View
      extends Object
      implements javafx.event.EventHandler<javafx.scene.input.KeyEvent>

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `GameObj` | `ball` | The bat
    `GameObj` | `bat` |
    `GameObj[]` | `bricks` | The ball
    `javafx.scene.canvas.Canvas` | `canvas` | basic layout pane
    `Controller` | `controller` | The other parts of the model-view-controller setup
    `int` | `height` | width of window
    `javafx.scene.control.Label` | `infoText` | canvas to draw game on
    `Model` | `model` |
    `javafx.scene.layout.Pane` | `pane` | user interface objects
    `int` | `score` | The bricks
    `int` | `width` | variables for components of the user interface

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `View​(int w, int h)` | constructor method - we get told the width and height of the window

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `displayGameObj​(javafx.scene.canvas.GraphicsContext gc, GameObj go)` | Display a game object - it is just a rectangle on the canvas
    `void` | `drawPicture()` | drawing the game image
    `void` | `handle​(javafx.scene.input.KeyEvent event)` | Event handler for key presses - it just passes the event to the controller
    `void` | `start​(javafx.stage.Stage window)` | start is called from the Main class, to start the GUI up
    `void` | `update()` | This is how the Model talks to the View This method gets called BY THE MODEL, whenever the model changes It has to do whatever is required to update the GUI to show the new game position

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### width

          public int width

      variables for components of the user interface

    - #### height

          public int height

      width of window

    - #### pane

          public javafx.scene.layout.Pane pane

      user interface objects

    - #### canvas

          public javafx.scene.canvas.Canvas canvas

      basic layout pane

    - #### infoText

          public javafx.scene.control.Label infoText

      canvas to draw game on

    - #### controller

          public Controller controller

      The other parts of the model-view-controller setup

    - #### model

          public Model model

    - #### bat

          public GameObj bat

    - #### ball

          public GameObj ball

      The bat

    - #### bricks

          public GameObj[] bricks

      The ball

    - #### score

          public int score

      The bricks

  - ### Constructor Detail

    - #### View

          public View​(int w,
                      int h)

      constructor method - we get told the width and height of the window

  - ### Method Detail

    - #### start

          public void start​(javafx.stage.Stage window)

      start is called from the Main class, to start the GUI up

    - #### handle

          public void handle​(javafx.scene.input.KeyEvent event)

      Event handler for key presses - it just passes the event to the controller
      Specified by:
        `handle` in interface `javafx.event.EventHandler<javafx.scene.input.KeyEvent>`

    - #### drawPicture

          public void drawPicture()

      drawing the game image

    - #### displayGameObj

          public void displayGameObj​(javafx.scene.canvas.GraphicsContext gc,
                                     GameObj go)

      Display a game object - it is just a rectangle on the canvas

    - #### update

          public void update()

      This is how the Model talks to the View This method gets called BY THE MODEL, whenever the model changes It has to do whatever is required to update the GUI to show the new game position