# G4P Question - Create / hide second screen

**URL:** <https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132>\
**Category:** Libraries\
**Created:** [March 9, 2019, 1:52am UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132 "2019-03-09T01:52:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![WyattStorch](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@WyattStorch](https://discourse.processing.org/u/WyattStorch)\
**Post date:** [March 9, 2019, 1:52am UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132/1 "2019-03-09T01:52:51Z")

</div>

@quark

I apologize in advance for my newbiness. I’m using Processing 3.5.3, G4P V4.2.1, and GUI Builder 4.3 in Windows 7 64 bit. I love your utility but in my newbiness I’m having a devil of a time trying to figure it out. I confess I can’t grasp how to find out how to do anything using the reference page at your link. I’m not new on how to program things in basic-like languages but I’m new to Java and confess most OOP policies just confuse me on what happens when.

Anyway, I’ve been playing around some and I wonder if you could give me an example using GUI builder. I’d like to create a main screen with a button on it that launches a second screen that covers/obscures the main screen completely. On the second screen is a button that hides/suspends/closes/obscures the second screen and returns the view and execution to the main screen. So I can switch back and forth. I can’t find an example to copy that from.

In the application I’m building the main screen runs a lot of display stuff and the second screen will be used to change a lot of settings.

Thanks in advance. I’m sorry to be reduced to asking like this but I’m stumped.

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [March 9, 2019, 8:44am UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132/2 "2019-03-09T08:44:01Z")

</div>

My website [www.lagers.org.uk](http://www.lagers.org.uk) has several videos showing GUI Builder in action and there are a lot more guides for G4P so have a look there first.

---

<div class="post-metadata">

**Author:** ![WyattStorch](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@WyattStorch](https://discourse.processing.org/u/WyattStorch)\
**Post date:** [March 9, 2019, 10:50pm UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132/3 "2019-03-09T22:50:33Z")

</div>

I saw all those, thanks for them.

I need to make a button that opens a second window (there are examples for that) and one to go on the second window to close it. Sorry to bother you. Or. Where can I find out if there is a secondwindow.close or something? Most answers that come up in search are for previous versions.

Thanks.

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [March 10, 2019, 12:58pm UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132/4 "2019-03-10T12:58:01Z")

</div>

The website guide to G4P explains that is better not to open/close windows on need rather to create them in setup and make them visible / invisible as needed.

There are plenty of examples of creating windows and you can use

```auto
window.visible(false); // to hide the window and
window.visible(true); // to show the window  

```

you can add these statements to button event handlers.

---

<div class="post-metadata">

**Author:** ![WyattStorch](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@WyattStorch](https://discourse.processing.org/u/WyattStorch)\
**Post date:** [March 11, 2019, 2:28am UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132/5 "2019-03-11T02:28:58Z")

</div>

Thank you! And thank you for this excellent library.

---

<div class="post-metadata">

**Author:** ![WyattStorch](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@WyattStorch](https://discourse.processing.org/u/WyattStorch)\
**Post date:** [March 11, 2019, 1:03pm UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132/6 "2019-03-11T13:03:20Z")

</div>

I used the GUI builder from a fresh start.  
I created a second window.  
It got called “window1”.  
I put a button on the second screen.  
I edited the event handler for the button by adding the statement;  
`window1.visible(false);`  
and got  
`the function "visible(boolean)" does not exist`.  
I’m missing something basic here. And I’m reading all the documentation I can find. I’m learning lots of other stuff but not what I’m after. Please, I could use a clue.

I need to have one button on the main screen that shows a second window and a button on the second window that hides the second window and shows the main screen.

Thanks in advance for any more clues.

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [March 11, 2019, 4:26pm UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132/7 "2019-03-11T16:26:02Z")

</div>

Try  
`window1.setVisible(false);`

---

<div class="post-metadata">

**Author:** ![WyattStorch](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@WyattStorch](https://discourse.processing.org/u/WyattStorch)\
**Post date:** [March 11, 2019, 4:44pm UTC](https://discourse.processing.org/t/g4p-question-create-hide-second-screen/9132/8 "2019-03-11T16:44:59Z")

</div>

It worked! Thanks so much.
