# Another simple question

**URL:** <https://forum.juce.com/t/another-simple-question/9796>\
**Category:** General JUCE discussion\
**Created:** [January 8, 2013, 10:43pm UTC](https://forum.juce.com/t/another-simple-question/9796 "2013-01-08T22:43:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vipersnake](https://avatars.discourse-cdn.com/v4/letter/v/f04885/32.png) [@vipersnake](https://forum.juce.com/u/vipersnake)\
**Post date:** [January 8, 2013, 10:43pm UTC](https://forum.juce.com/t/another-simple-question/9796/1 "2013-01-08T22:43:22Z")

</div>

Make great progress learning Juce (and still lots to go). Simple question is if all I want is a component that is blue, red, grey or anything really is there an easy way to do this?

I use a lot of colors as backgrounds and then put other controls on top of them. In the past I would use a UIView and just set the background color.

Thanks

Michael

---

<div class="post-metadata">

**Author:** ![jiggerypokery](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jiggerypokery](https://forum.juce.com/u/jiggerypokery)\
**Post date:** [January 8, 2013, 11:32pm UTC](https://forum.juce.com/t/another-simple-question/9796/2 "2013-01-08T23:32:21Z")

</div>

Use graphics to draw an image that is just a block of colour.

```auto

```

`Graphics::drawImageAt (const Image& imageToDraw,
                            const int topLeftX, const int topLeftY,
                            const bool fillAlphaChannelWithCurrentBrush) const`  
Make an image

```auto
Image image(Image::RGB, [i]width in pixels[/i], [i]height in pixels[/i], true)
Graphics g (image)
g.fillAll(Colours:: [i]whatever colour you want[/i])
```

Then draw it with graphics

```auto

```

---

<div class="post-metadata">

**Author:** ![valley](https://avatars.discourse-cdn.com/v4/letter/v/67e7ee/32.png) [@valley](https://forum.juce.com/u/valley)\
**Post date:** [January 8, 2013, 11:49pm UTC](https://forum.juce.com/t/another-simple-question/9796/3 "2013-01-08T23:49:02Z")

</div>

Do you just mean:

```auto
class MyComp : public Component
{
public:

  virtual void paint(Graphics& g)
  {
    g.fillAll(Colours::red);
  }

};
```

?

---

<div class="post-metadata">

**Author:** ![vipersnake](https://avatars.discourse-cdn.com/v4/letter/v/f04885/32.png) [@vipersnake](https://forum.juce.com/u/vipersnake)\
**Post date:** [January 9, 2013, 12:36am UTC](https://forum.juce.com/t/another-simple-question/9796/4 "2013-01-09T00:36:52Z")

</div>

This is exactly what I did. Made a ColorComponent to handle it. Super easy but I also thought there was a chance that basic Component handled it.

Thanks for keeping me on the right track.

[quote=“valley”]Do you just mean:

```auto
class MyComp : public Component
{
public:

  virtual void paint(Graphics& g)
  {
    g.fillAll(Colours::red);
  }

};
```

?[/quote]
