# How to find number of displays

**URL:** <https://discourse.processing.org/t/how-to-find-number-of-displays/13037>\
**Category:** Coding Questions\
**Created:** [July 29, 2019, 1:16pm UTC](https://discourse.processing.org/t/how-to-find-number-of-displays/13037 "2019-07-29T13:16:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jtk/32/4989_2.png) [@jtk](https://discourse.processing.org/u/jtk)\
**Post date:** [July 29, 2019, 1:16pm UTC](https://discourse.processing.org/t/how-to-find-number-of-displays/13037/1 "2019-07-29T13:16:05Z")

</div>

Is there a way to find out how many displays are available to my Processing program?

I would like my sketch to start in fullScreen on display 2 if it is connected, otherwise display 1. Currently, I’m using fullScreen(2) and it gives a warning if there is no display 2, but still works. I’d like to avoid the warning, if possible, by checking for the presence of display 2 before I go fullScreen on it.

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [August 31, 2019, 5:56am UTC](https://discourse.processing.org/t/how-to-find-number-of-displays/13037/2 "2019-08-31T05:56:14Z")

</div>

You can have a look at the source code and implement a solution for your use case. Points of interest in the source code:

- [https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L953](https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L953)
- [https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L1884](https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L1884)
- [https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L10600](https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L10600)

The last link shows that you can specify a parameter when running your sketch. It could be handy in certain scenarios as for example, if your code was an executable.

Kf

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [August 31, 2019, 11:24am UTC](https://discourse.processing.org/t/how-to-find-number-of-displays/13037/3 "2019-08-31T11:24:06Z")

</div>

- @kfrajer, avoid linking the master branch when using links w/ `#L`. ⚠
- B/c it’s constantly being worked on, the line number isn’t gonna be the same for long. 👷‍♂️
- Instead, link to a specific tag branch, b/c it’s frozen forever. 🧊

---

<div class="post-metadata">

**Author:** ![jtk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jtk/32/4989_2.png) [@jtk](https://discourse.processing.org/u/jtk)\
**Post date:** [August 31, 2019, 11:35am UTC](https://discourse.processing.org/t/how-to-find-number-of-displays/13037/4 "2019-08-31T11:35:28Z")

</div>

Excellent, thanks! The GraphicsEnvironment (with GraphicsDevice[] list) gives me exactly what I need.
