> For the complete documentation index, see [llms.txt](https://noahcoetsee.gitbook.io/javadraw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://noahcoetsee.gitbook.io/javadraw/quick-reference/window.md).

# Window

{% hint style="info" %}
Quick Reference can help with small issues or lessen the learning curve, but it can never replace the full documentation which is available [here](https://javadraw.graphics/api/).
{% endhint %}

## Utilization

The first thing you will do in javaDraw is create a class that extends the "Window" class, allowing it to handle input. In order to actually open a visual window on the computer, you will need to call the `Window.open()` method.

```java
public class Driver extends Window {

    public static void main(String[] args) {
        Window.open();
    }

}
```

We can then add the `start()` method to run code when the window opens:

```java
public class Driver extends Window {

    public static void main(String[] args) {
        Window.open();
    }
    
    public void start() {
        // ... now we can write some code here!
    }

}
```

## Input

The input system in javaDraw is designed to be used in the most simple way possible. Input methods are called asynchronously while the primary program remains on the window thread.

There are many input methods:

```java
public class Driver extends Window {

    public static void main(String[] args) {
        Window.open();
    }
    
    public void mouseDown(int button, Location location) {}
    
    public void mouseUp(int button, Location location) {}
    
    public void mouseDrag(int button, Location location) {}
    
    public void mouseMove(Location location) {}
    
    public void keyDown(Key key) {}
    
    public void keyUp(Key key) {}

}
```

You can add whichever input methods you need for your program and leave the others out with no issue.
