# GUI button not visible

**URL:** <https://forum.juce.com/t/gui-button-not-visible/26186>\
**Category:** Android\
**Created:** [January 30, 2018, 9:04pm UTC](https://forum.juce.com/t/gui-button-not-visible/26186 "2018-01-30T21:04:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lupino22](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@lupino22](https://forum.juce.com/u/lupino22)\
**Post date:** [January 30, 2018, 9:04pm UTC](https://forum.juce.com/t/gui-button-not-visible/26186/1 "2018-01-30T21:04:20Z")

</div>

Hello. I’ve created my first application. I’ve used Projucer -\> New Project -\> GUI application  
And wrote following code, but my buttons are not visible.

```
MainContentComponent::MainContentComponent()
    : myButton("My Button")
{
    setSize (500, 500);
}

```

in MainContentComponent::~MainContentComponent()

```
if(! myButton.isDown()) myButton.setEnabled(false);
addAndMakeVisible(myButton);

```

in MainContentComponent::resized()

```
myButton.setBounds(margin, getHeight() /2 , getWidth() + 35, 35);
// also tried BoundsRelative

```

MainContentComponent::paint is empty

What am i missing?

---

<div class="post-metadata">

**Author:** ![cpr2323](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/cpr2323/32/18682_2.png) [@cpr2323](https://forum.juce.com/u/cpr2323)\
**Post date:** [January 30, 2018, 9:10pm UTC](https://forum.juce.com/t/gui-button-not-visible/26186/2 "2018-01-30T21:10:07Z")

</div>

I’m not sure you understand what a destructir is. Ie. None of the things you are doing in ~MainContentComponent will have any effect on making your button visible, because that function is executed when the MaonContentComponent is destroyd.

---

<div class="post-metadata">

**Author:** ![cpr2323](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/cpr2323/32/18682_2.png) [@cpr2323](https://forum.juce.com/u/cpr2323)\
**Post date:** [January 30, 2018, 9:12pm UTC](https://forum.juce.com/t/gui-button-not-visible/26186/3 "2018-01-30T21:12:01Z")

</div>

As well, the button you reference in resize is not myButton

---

<div class="post-metadata">

**Author:** ![lupino22](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@lupino22](https://forum.juce.com/u/lupino22)\
**Post date:** [January 30, 2018, 9:14pm UTC](https://forum.juce.com/t/gui-button-not-visible/26186/4 "2018-01-30T21:14:19Z")

</div>

oh yeah i forgot to change button name, but still same

---

<div class="post-metadata">

**Author:** ![cpr2323](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/cpr2323/32/18682_2.png) [@cpr2323](https://forum.juce.com/u/cpr2323)\
**Post date:** [January 30, 2018, 9:36pm UTC](https://forum.juce.com/t/gui-button-not-visible/26186/5 "2018-01-30T21:36:22Z")

</div>

The code does not belong in the destructor

---

<div class="post-metadata">

**Author:** ![PluginPenguin](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pluginpenguin/32/10203_2.png) [@PluginPenguin](https://forum.juce.com/u/PluginPenguin)\
**Post date:** [January 31, 2018, 6:56am UTC](https://forum.juce.com/t/gui-button-not-visible/26186/6 "2018-01-31T06:56:27Z")

</div>

Did you see the GUI [tutorials](https://juce.com/tutorials)? Maybe it will help you to follow them and then modify them.  
Just a quick thought: Are you sure that the coordinates you pass to `myButton.setBounds` are inside the MainContentComponents bounds? `getHeight()/2` should work, but what’s the value of `margin`?
