O'Reilly logo

Getting Started With JUCE by Martin Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using drawing operations

Although it is advisable to use the built-in components if possible, there are occasions where you may need or wish to create a completely new custom component. This may be to perform some specific drawing tasks or a unique user interface item. JUCE also handles this elegantly.

First, create a new Introjucer project and name it Chapter02_05. To perform drawing tasks in a component, you should override the Component::paint() function. Change the contents of the MainComponent.h file to:

#ifndef __MAINCOMPONENT_H__
#define __MAINCOMPONENT_H__

#include "../JuceLibraryCode/JuceHeader.h"

class MainContentComponent :  public Component
{
public:
  MainContentComponent();
  void paint (Graphics& g);
};
#endif

Change the contents of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required