# Bare Minimum Code to Use GUI Component in Plugin

**URL:** <https://forum.juce.com/t/bare-minimum-code-to-use-gui-component-in-plugin/22391>\
**Category:** General JUCE discussion\
**Created:** [May 12, 2017, 12:47pm UTC](https://forum.juce.com/t/bare-minimum-code-to-use-gui-component-in-plugin/22391 "2017-05-12T12:47:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe-04-04](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/joe-04-04/32/2566_2.png) [@joe-04-04](https://forum.juce.com/u/joe-04-04)\
**Post date:** [May 12, 2017, 12:47pm UTC](https://forum.juce.com/t/bare-minimum-code-to-use-gui-component-in-plugin/22391/1 "2017-05-12T12:47:49Z")

</div>

I had no issues finding and replacing the code in a “GUI Application” so that I could use a GUI component and edit visually. However, I’m having a terrible time adding a GUI component to an audio plugin session and finding the right code to swap to accept that new GUI component as the primary window. Does anyone have a template of this? I just overwrote the pluginEditor with the GUI component and looked for errors to replace, but I found myself quickly lost.

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [May 12, 2017, 12:55pm UTC](https://forum.juce.com/t/bare-minimum-code-to-use-gui-component-in-plugin/22391/2 "2017-05-12T12:55:14Z")

</div>

- The Component must inherit AudioProcessorEditor
- The constructor must take an AudioProcessor& reference, see the original template
- In [AudioProcessor::createEditor()](https://juce.com/doc/classAudioProcessor#a103fc8a8666b7d31b472e017262be84d) return an instance of your component.

That should do it AFAIK

---

<div class="post-metadata">

**Author:** ![joe-04-04](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/joe-04-04/32/2566_2.png) [@joe-04-04](https://forum.juce.com/u/joe-04-04)\
**Post date:** [May 13, 2017, 8:35am UTC](https://forum.juce.com/t/bare-minimum-code-to-use-gui-component-in-plugin/22391/3 "2017-05-13T08:35:14Z")

</div>

Once again, thanks Daniel. You got me up and running.
